add: guard in router

This commit is contained in:
Alexandro Uc Santos
2024-12-14 17:46:38 -06:00
parent e24f96c061
commit fa56d25258
9 changed files with 148 additions and 37 deletions

View File

@@ -98,7 +98,7 @@
localStorage.setItem('id', result.data._id);
localStorage.setItem('session', auth.sesion);
// localStorage.setItem('access', auth.token);
localStorage.setItem('access', auth.accessToken);
const userData = {
"first_name" : user.name,
@@ -109,6 +109,7 @@
let respUser = await updateMyUserProfile( userData );
if(respUser.msg === 'success') {
auth.user = respUser.data;
auth.isAuthenticated = true;
} else {
auth.user = userData;
}

View File

@@ -48,6 +48,7 @@
sesion: resp.data.session_token,
token: resp.data.accessToken,
user: resp.data.user,
isAuthenticated: true
})
} else { // Completar registro
auth.$patch({

View File

@@ -27,7 +27,6 @@
})
const getInitialData = async() => {
await auth.authenticationPromise;
await company.getCompanyData();
}

View File

@@ -0,0 +1,13 @@
<template>
<div>
<h1>No encontrada</h1>
</div>
</template>
<script setup>
</script>
<style lang="scss" scoped>
</style>