Fixing authentication workflow

This commit is contained in:
mati108@gmail.com committed 2018-10-15 10:09:10 -03:00
1 parent 7ddc4cd543
commit f80cd2d543
1 file changed
+6 -6
+6 -6
View File
@@ -182,21 +182,21 @@ class Auth {
async signinOrCreateAccount ({ accessToken, idToken, expiresAt }) {
try {
const data = await client.mutate({
const response = await client.mutate({
mutation: AUTHENTICATE,
variables: { idToken }
})
Log.info('auth.signinOrCreateAccount data:')
Log.info(await data)
Log.info(response)
const user = {
authId: await data.teams_Authenticate.authId,
alias: await data.teams_Authenticate.alias
authId: response.data.teams_Authenticate.authId,
alias: response.data.teams_Authenticate.alias
}
setItem('user', JSON.stringify(user))
if (window.location.href.includes(`callback`)) {
window.location.href = '/dashboard'
window.location.href = '/'
}
return data
return response.data
} catch (err) {
return console.log('Sign in or create account error: ', err)
}