fix(example): javascript auth

This commit is contained in:
Harsh Karande committed 2021-12-08 12:38:50 +05:30
1 parent 14b272550d
commit da694f1405
1 file changed
+3 -3
+3 -3
View File
@@ -30,7 +30,7 @@ const signUpSubmitted = (event) => {
response.error ? alert(response.error.message) : setToken(response)
})
.catch((err) => {
alert(err.response.text)
alert(err)
})
}
@@ -58,7 +58,7 @@ const logoutSubmitted = (event) => {
supabase.auth
.signOut()
.then((response) => {
.then((_response) => {
document.querySelector('#access-token').value = ''
document.querySelector('#refresh-token').value = ''
alert('Logout successful')
@@ -69,7 +69,7 @@ const logoutSubmitted = (event) => {
}
function setToken(response) {
if (response.data.confirmation_sent_at && !response.data.access_token) {
if (response.user.confirmation_sent_at && !response?.data?.access_token) {
alert('Confirmation Email Sent')
} else {
document.querySelector('#access-token').value = response.data.access_token