|
|
@ -51,7 +51,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => { |
|
|
|
await tryGoogleAuth(api, state.signIn) |
|
|
|
await tryGoogleAuth(api, state.signIn) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await tryShortTokenAuth(api, state.signIn) |
|
|
|
if (!state.signedIn.value) await tryShortTokenAuth(api, state.signIn) |
|
|
|
|
|
|
|
|
|
|
|
/** if public allow all visitors */ |
|
|
|
/** if public allow all visitors */ |
|
|
|
if (to.meta.public) return |
|
|
|
if (to.meta.public) return |
|
|
@ -166,9 +166,7 @@ async function tryShortTokenAuth(api: Api<any>, signIn: Actions['signIn']) { |
|
|
|
let extraProps: any = {} |
|
|
|
let extraProps: any = {} |
|
|
|
try { |
|
|
|
try { |
|
|
|
// `extra` prop is used in our cloud implementation, so we are keeping it
|
|
|
|
// `extra` prop is used in our cloud implementation, so we are keeping it
|
|
|
|
const { |
|
|
|
const { data } = await api.instance.post( |
|
|
|
data, |
|
|
|
|
|
|
|
} = await api.instance.post( |
|
|
|
|
|
|
|
`/auth/long-lived-token`, |
|
|
|
`/auth/long-lived-token`, |
|
|
|
{}, |
|
|
|
{}, |
|
|
|
{ |
|
|
|
{ |
|
|
@ -178,11 +176,8 @@ async function tryShortTokenAuth(api: Api<any>, signIn: Actions['signIn']) { |
|
|
|
}, |
|
|
|
}, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
console.log(data) |
|
|
|
|
|
|
|
debugger |
|
|
|
|
|
|
|
const { token, extra } = data |
|
|
|
const { token, extra } = data |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if extra prop is null/undefined set it as an empty object as fallback
|
|
|
|
// if extra prop is null/undefined set it as an empty object as fallback
|
|
|
|
extraProps = extra || {} |
|
|
|
extraProps = extra || {} |
|
|
|
|
|
|
|
|
|
|
|