mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-24 20:17:31 -04:00
fix analytics send error loop
This commit is contained in:
parent
5127e93fc7
commit
874a8455d4
1 changed files with 4 additions and 4 deletions
|
@ -13,10 +13,10 @@ func _ready() -> void:
|
||||||
func send_event(body: Dictionary = {}) -> void:
|
func send_event(body: Dictionary = {}) -> void:
|
||||||
var url = backend.analytics_event
|
var url = backend.analytics_event
|
||||||
var callback = func(_result, code, _headers, _body):
|
var callback = func(_result, code, _headers, _body):
|
||||||
if code != 200: Debug.logerr("Request send_event failed. Code " + str(code))
|
if code != 200: Debug.logclr("Request send_event failed. Code " + str(code), Color.RED)
|
||||||
|
|
||||||
var err = await request(url, callback, body, HTTPClient.METHOD_POST)
|
var err = await request(url, callback, body, HTTPClient.METHOD_POST)
|
||||||
if err != HTTPRequest.RESULT_SUCCESS: Debug.logerr("Cannot send request send_event")
|
if err != HTTPRequest.RESULT_SUCCESS: Debug.logclr("Cannot send request send_event", Color.RED)
|
||||||
|
|
||||||
|
|
||||||
func get_user_id() -> void:
|
func get_user_id() -> void:
|
||||||
|
@ -24,10 +24,10 @@ func get_user_id() -> void:
|
||||||
var callback = func(_result, code, _headers, body):
|
var callback = func(_result, code, _headers, body):
|
||||||
if code == 200:
|
if code == 200:
|
||||||
AnalyticsEvents.user_id = body.get_string_from_utf8()
|
AnalyticsEvents.user_id = body.get_string_from_utf8()
|
||||||
else: Debug.logerr("Request get_user_id failed. Code " + str(code))
|
else: Debug.logclr("Request get_user_id failed. Code " + str(code), Color.RED)
|
||||||
|
|
||||||
var err = await request(url, callback)
|
var err = await request(url, callback)
|
||||||
if err != HTTPRequest.RESULT_SUCCESS: Debug.logerr("Cannot send request get_user_id")
|
if err != HTTPRequest.RESULT_SUCCESS: Debug.logclr("Cannot send request get_user_id", Color.RED)
|
||||||
|
|
||||||
|
|
||||||
func request(url: String, callback: Callable,
|
func request(url: String, callback: Callable,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue