Skip to content
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

Refactor SessionStatus #725

Merged
merged 12 commits into from
Sep 20, 2024
Merged

Refactor SessionStatus #725

merged 12 commits into from
Sep 20, 2024

Conversation

jan-tennert
Copy link
Collaborator

@jan-tennert jan-tennert commented Sep 16, 2024

What kind of change does this PR introduce?

Feature and Bug fix (closes #724)

What is the current behavior?

The session gets cleared if the refresh operation fails, no matter the cause/status code. You also cannot get the exception the refresh operation fails with in your code.

What is the new behavior?

SessionStatus has been moved to its own status package. There have been changes to two statuses:
LoadingFromStorage -> Initializing
NetworkError -> data class RefreshFailure(cause)
The cause can be one of two things:

  • RefreshFailureCause.NetworkError(exception: Throwable)
  • RefreshFailureCause.InternalServerError(exception: RestException)

Additional context

Add any other context or screenshots.

# Conflicts:
#	Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/PostgrestRpc.kt
#	Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/request/RpcRequest.kt
#	gradle.properties
@jan-tennert jan-tennert changed the base branch from 2.6.X to master September 20, 2024 08:12
@jan-tennert jan-tennert changed the title Ignore 5XX http status codes for session refreshes Refactor SessionStatus Sep 20, 2024
@github-actions github-actions bot added the auth label Sep 20, 2024
@jan-tennert jan-tennert merged commit 5de19c4 into master Sep 20, 2024
12 checks passed
@jan-tennert jan-tennert deleted the auth-fix branch September 20, 2024 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: UserSession is deleted when backend is unavailable (503)
1 participant