Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/supabase/Auth/auth.gd
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func _process_task(task : AuthTask, _fake : bool = false) -> void:
else:
var httprequest : HTTPRequest = HTTPRequest.new()
add_child(httprequest)
task.push_request(httprequest)
await task.push_request(httprequest)


func _on_task_completed(task : AuthTask) -> void:
Expand Down
2 changes: 1 addition & 1 deletion addons/supabase/Auth/auth_error.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class_name SupabaseAuthError
func _init(dictionary : Dictionary = {}) -> void:
_error = dictionary
if not _error.is_empty():
hint = _error.get("error", "(undefined)")
type = _error.get("error", "(undefined)")
hint = _error.get("error_description", "(undefined)")
if _error.has("code"):
code = str(_error.get("code", -1))
Expand Down
7 changes: 5 additions & 2 deletions addons/supabase/Auth/auth_task.gd
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ func match_code(code: int = Task.NONE) -> int:
return HTTPClient.METHOD_GET

func _on_task_completed(result : int, response_code : int, headers : PackedStringArray, body : PackedByteArray, handler: HTTPRequest) -> void:
var result_body : Dictionary = JSON.parse_string(body.get_string_from_utf8())
var result_body : Dictionary

if(!body.is_empty()):
result_body = JSON.parse_string(body.get_string_from_utf8())

match response_code:
200:
match _code:
Expand All @@ -46,7 +50,6 @@ func _on_task_completed(result : int, response_code : int, headers : PackedStrin
Task.LOGOUT, Task.USER:
complete()
_:
if result_body == null : result_body = {}
complete(null, {}, SupabaseAuthError.new(result_body))
handler.queue_free()

Expand Down
1 change: 1 addition & 0 deletions addons/supabase/base_error.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class_name BaseError

var _error : Dictionary
var code : String = "empty"
var type : String = "empty"
var message : String = "empty"
var hint : String = "empty"
var details
Expand Down
1 change: 1 addition & 0 deletions addons/supabase/base_task.gd
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func match_code(code : int) -> int:
func push_request(httprequest : HTTPRequest) -> void:
httprequest.request_completed.connect(_on_task_completed.bind(httprequest))
httprequest.request(_endpoint, _headers, true, _method, _payload)
await httprequest.request_completed

func _on_task_completed(result : int, response_code : int, headers : PackedStringArray, body : PackedByteArray, handler: HTTPRequest) -> void:
pass
Expand Down