diff --git a/src/boot/axios.js b/src/boot/axios.js index 2f454188e..cbd5e7213 100644 --- a/src/boot/axios.js +++ b/src/boot/axios.js @@ -58,9 +58,12 @@ const onResponseError = (error) => { break; } - if (session.isLoggedIn && response.status === 401) { + if (session.isLoggedIn() && response.status === 401) { session.destroy(); Router.push({ path: '/login' }); + } else if(!session.isLoggedIn()) + { + message = 'login.loginError'; } Notify.create({ diff --git a/src/components/UserPanel.vue b/src/components/UserPanel.vue index 6bc00d5ce..a7504705a 100644 --- a/src/components/UserPanel.vue +++ b/src/components/UserPanel.vue @@ -70,7 +70,7 @@ async function saveDarkMode(value) { } async function saveLanguage(value) { - const query = `/Accounts/${user.value.id}`; + const query = `/VnUsers/${user.value.id}`; await axios.patch(query, { lang: value, }); diff --git a/src/composables/useRole.js b/src/composables/useRole.js index b8da153d3..a781785a0 100644 --- a/src/composables/useRole.js +++ b/src/composables/useRole.js @@ -5,7 +5,7 @@ export function useRole() { const state = useState(); async function fetch() { - const { data } = await axios.get('Accounts/acl'); + const { data } = await axios.get('VnUsers/acl'); const roles = data.roles.map((userRoles) => userRoles.role.name); const userData = { diff --git a/src/pages/Login/LoginMain.vue b/src/pages/Login/LoginMain.vue index 7fb0ee408..747fe8b14 100644 --- a/src/pages/Login/LoginMain.vue +++ b/src/pages/Login/LoginMain.vue @@ -48,25 +48,29 @@ const password = ref(''); const keepLogin = ref(true); async function onSubmit() { - const { data } = await axios.post('Accounts/login', { - user: username.value, - password: password.value, - }); + try { + const { data } = await axios.post('Accounts/login', { + user: username.value, + password: password.value, + }); - if (!data) return; + if (!data) return; - await session.login(data.token, keepLogin.value); + await session.login(data.token, keepLogin.value); - quasar.notify({ - message: t('login.loginSuccess'), - type: 'positive', - }); + quasar.notify({ + message: t('login.loginSuccess'), + type: 'positive', + }); - const currentRoute = router.currentRoute.value; - if (currentRoute.query && currentRoute.query.redirect) { - router.push(currentRoute.query.redirect); - } else { - router.push({ name: 'Dashboard' }); + const currentRoute = router.currentRoute.value; + if (currentRoute.query && currentRoute.query.redirect) { + router.push(currentRoute.query.redirect); + } else { + router.push({ name: 'Dashboard' }); + } + } catch (e) { + // } } diff --git a/src/pages/Ticket/Card/TicketBoxing.vue b/src/pages/Ticket/Card/TicketBoxing.vue index 9d46ddba2..05bde8977 100644 --- a/src/pages/Ticket/Card/TicketBoxing.vue +++ b/src/pages/Ticket/Card/TicketBoxing.vue @@ -1,9 +1,9 @@