Skip to content

Commit

Permalink
Adding $llanaAuthCheck for quick auth check
Browse files Browse the repository at this point in the history
  • Loading branch information
andyslack committed Dec 16, 2024
1 parent 4a14af4 commit ab683c5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions nuxtjs/src/runtime/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,22 @@ export default defineNuxtPlugin(({ $config }) => {
}
}

async function AuthCheck(): Promise<boolean> {
if (!getToken()) {
return false
}else{
try{
const profile = await GetProfile()
if(!profile){
return false
}
}catch(e){
return false
}
}
return true
}

return {
provide: {
llana: run,
Expand All @@ -310,6 +326,7 @@ export default defineNuxtPlugin(({ $config }) => {
llanaSubscribe: Subscribe,
llanaInstanceUrl: LLANA_INSTANCE_URL,
llanaAccessToken: getToken(),
llanaAuthCheck: AuthCheck,
},
}
})

0 comments on commit ab683c5

Please sign in to comment.