Skip to content

Commit 59d52b7

Browse files
committed
fix: #22 wont throw error for confirmation email signups
1 parent 8318ed1 commit 59d52b7

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

src/Auth.js

+17-15
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,23 @@ class Auth {
2020
.set('accept', 'json')
2121
.set('apikey', this.supabaseKey)
2222

23-
if (response.status === 200 && response['body']['user']['confirmed_at']) {
24-
this.accessToken = response.body['access_token']
25-
this.refreshToken = response.body['refresh_token']
26-
this.currentUser = response.body['user']
27-
let tokenExpirySeconds = response.body['expires_in']
28-
if (this.autoRefreshToken && tokenExpirySeconds)
29-
setTimeout(this.callRefreshToken, (tokenExpirySeconds - 60) * 1000)
30-
if (this.persistSession) {
31-
const timeNow = Math.round(Date.now() / 1000)
32-
this.saveSession(
33-
this.accessToken,
34-
this.refreshToken,
35-
timeNow + tokenExpirySeconds,
36-
this.currentUser
37-
)
23+
if (response.status === 200) {
24+
if (response['body']['user']) {
25+
this.accessToken = response.body['access_token']
26+
this.refreshToken = response.body['refresh_token']
27+
this.currentUser = response.body['user']
28+
let tokenExpirySeconds = response.body['expires_in']
29+
if (this.autoRefreshToken && tokenExpirySeconds)
30+
setTimeout(this.callRefreshToken, (tokenExpirySeconds - 60) * 1000)
31+
if (this.persistSession) {
32+
const timeNow = Math.round(Date.now() / 1000)
33+
this.saveSession(
34+
this.accessToken,
35+
this.refreshToken,
36+
timeNow + tokenExpirySeconds,
37+
this.currentUser
38+
)
39+
}
3840
}
3941
}
4042
return response

0 commit comments

Comments
 (0)