Wrap loadUser call in a try-catch block

This commit is contained in:
Maciej Pędzich 2023-05-26 12:22:25 +02:00
parent ad0558d7cb
commit 6f1ac8a99e

View File

@ -8,7 +8,13 @@ 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();