mirror of
https://github.com/maciejpedzich/racemash.git
synced 2024-11-27 16:15:47 +01:00
Move loadUser error handling to the function itself
This commit is contained in:
parent
bf18b7c4c7
commit
f8465276e3
@ -29,6 +29,12 @@ export function useAuth() {
|
||||
|
||||
const currentUser = await account.get();
|
||||
user.value = currentUser;
|
||||
} catch (error) {
|
||||
if (import.meta.env.DEV) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
user.value = null;
|
||||
} finally {
|
||||
loadingUserFinished.value = true;
|
||||
}
|
||||
|
@ -8,13 +8,7 @@ export async function authGuard(
|
||||
) {
|
||||
const { isLoggedIn, loadUser } = useAuth();
|
||||
|
||||
try {
|
||||
await loadUser();
|
||||
} catch (error) {
|
||||
if (import.meta.env.DEV) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!to.meta.authRequired || isLoggedIn.value) {
|
||||
return next();
|
||||
|
Loading…
Reference in New Issue
Block a user