diff options
author | vnugent <public@vaughnnugent.com> | 2023-08-09 11:59:15 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2023-08-09 11:59:15 -0400 |
commit | 5dd4b69ebf4f407a2ba7ccc53fe43b445ab0684e (patch) | |
tree | c0e5613aa4e33c7f436f9c67d0a4d75c1b9bfb77 /front-end/src/views/Login/social | |
parent | c3c0ece6fb3a66c2de545858731a066d5542ff1e (diff) |
Package updates, lodash-es, release state fixes
Diffstat (limited to 'front-end/src/views/Login/social')
-rw-r--r-- | front-end/src/views/Login/social/[type].vue | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/front-end/src/views/Login/social/[type].vue b/front-end/src/views/Login/social/[type].vue index 5a803bd..bdb0240 100644 --- a/front-end/src/views/Login/social/[type].vue +++ b/front-end/src/views/Login/social/[type].vue @@ -32,11 +32,12 @@ </template> <script setup lang="ts"> -import { isEqual } from 'lodash' +import { isEqual } from 'lodash-es' import { useRouteParams, useRouteQuery } from '@vueuse/router' import { useSession, useWait, useUser, useTitle, configureApiCall } from '@vnuge/vnlib.browser' import { useRouter } from 'vue-router'; import { ref } from 'vue' +import { ITokenResponse } from '@vnuge/vnlib.browser/dist/session'; useTitle('Social Login') @@ -76,7 +77,7 @@ const run = async () => { loginUrl = '/login/social/auth0'; break; default: - router.push('/login') + router.push({ name: 'Login' }) break; } @@ -84,17 +85,17 @@ const run = async () => { await apiCall(async ({ axios }) => { const preppedLogin = prepareLogin() // Send the login request - const response = await axios.post(loginUrl, { nonce: nonce.value }) - if (response.data.success === true) { - // Finalize the login - await preppedLogin.finalize(response) - // If the login was successful, then we can redirect to the login page - router.push({ name: 'Login' }) - return - } - // Otherwise, we can show an error - throw { response } + const { data } = await axios.post<ITokenResponse>(loginUrl, { nonce: nonce.value }) + + data.getResultOrThrow() + + // Finalize the login + await preppedLogin.finalize(data) + + // If the login was successful, then we can redirect to the login page + router.push({ name: 'Login' }) }) + } else { switch (result.value) { case 'invalid': |