-
+
diff --git a/src/router/index.js b/src/router/index.js
index 81046d1..c481ba3 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -155,8 +155,8 @@ const router = createRouter({
router.beforeEach( async(to, from, next) => {
const requiresAuth = to.matched.some(url => url.meta.requiresAuth)
- const session = localStorage.getItem('session');
- if(requiresAuth) {
+ if(requiresAuth === true) {
+ const session = localStorage.getItem('session');
//Comprobamos si el usuario esta authenticado
if(session) {
// if(!authStore.user) {
diff --git a/src/services/public.js b/src/services/public.js
index 669adfe..b033d24 100644
--- a/src/services/public.js
+++ b/src/services/public.js
@@ -64,7 +64,7 @@ export const getCompanies = async(filter) => {
export const getLoadPublic = async(id) => {
try {
const endpoint = `/v1/public-load-tracking/${id}`;
- console.log(endpoint);
+ // console.log(endpoint);
const {data} = await api.get(endpoint);
return data;
} catch (error) {
diff --git a/src/stores/auth.js b/src/stores/auth.js
index 7b72efc..11670b6 100644
--- a/src/stores/auth.js
+++ b/src/stores/auth.js
@@ -1,6 +1,6 @@
import { defineStore } from "pinia";
import { ref, onMounted } from "vue";
-import { useRouter } from 'vue-router';
+import { useRoute, useRouter } from 'vue-router';
import { renewToken } from '../services/auth';
import {useNotificationsStore} from './notifications';
import {useCompanyStore} from './company';
@@ -11,6 +11,7 @@ import { updateMyUserProfile } from "../services/company";
export const useAuthStore = defineStore('auth', () => {
const router = useRouter();
+ const route = useRoute();
const noty = useNotificationsStore();
const company = useCompanyStore();
const loadStore = useLoadsStore();
@@ -19,16 +20,27 @@ export const useAuthStore = defineStore('auth', () => {
const checking = ref(false);
const authStatus = ref('checking');
const token = ref('')
- const user = ref(null)
+ const user = ref(null);
+ const publicNames = [
+ 'terms-conditions',
+ 'notice-privacy',
+ 'tracking-load',
+ 'faqs',
+ 'login',
+ 'register',
+ 'recovery',
+ 'register-company',
+ ]
onMounted( async() => {
checkSession();
});
+
const checkSession = async() => {
const session = localStorage.getItem('session');
authStatus.value = 'checking';
- if(session) {
+ if(session && !publicNames.includes(route.name)) {
checking.value = true;
const resp = await renewToken();
if(resp.msg === 'success') {