Skip to content

Commit a60cf54

Browse files
committed
chore: automatically logs the user in on signup
1 parent df4c199 commit a60cf54

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Auth.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ class Auth {
1919
.post(`${authUrl}/signup`, { email, password })
2020
.set('accept', 'json')
2121
.set('apikey', this.supabaseKey)
22-
return response
22+
return this.login(email, password)
2323
}
2424

2525
this.login = async (email, password) => {
26+
this.removeSavedSession() // clean out the old session before attempting
2627
let response = await superagent
2728
.post(`${authUrl}/token?grant_type=password`, { email, password })
2829
.set('accept', 'json')
@@ -104,7 +105,7 @@ class Auth {
104105

105106
this.removeSavedSession = () => {
106107
this.currentUser = null
107-
this.accessToken = null
108+
this.accessToken = this.supabaseKey
108109
isBrowser() && localStorage.removeItem(storageKey)
109110
}
110111

0 commit comments

Comments
 (0)