Skip to content

4.x patches #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all 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_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
2 changes: 2 additions & 0 deletions addons/supabase/base_task.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func match_code(code : int) -> int:
return -1

func push_request(httprequest : HTTPRequest) -> void:
reference()
httprequest.request_completed.connect(_on_task_completed.bind(httprequest))
httprequest.request(_endpoint, _headers, true, _method, _payload)

Expand All @@ -41,6 +42,7 @@ func _complete(_data = null, _error : BaseError = null) -> void:
data = _data
error = _error
completed.emit(self)
unreference()

func _to_string() -> String:
return "%s, %s" % [data, error]