make new localstorage function file
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { boot } from 'quasar/wrappers';
|
||||
import { useUserStore } from 'src/vueLib/login/userStore';
|
||||
import { appApi } from './axios';
|
||||
import { getLocalLastRoute, setLocalLastRoute } from 'src/localstorage/localStorage';
|
||||
|
||||
export default boot(async ({ router }) => {
|
||||
const userStore = useUserStore();
|
||||
@@ -14,7 +15,7 @@ export default boot(async ({ router }) => {
|
||||
|
||||
// Restore logic after router is ready but before navigation
|
||||
router.isReady().then(() => {
|
||||
const lastRoute = localStorage.getItem('lastRoute');
|
||||
const lastRoute = getLocalLastRoute();
|
||||
const currentPath = router.currentRoute.value.fullPath;
|
||||
|
||||
// Restore only if:
|
||||
@@ -34,7 +35,7 @@ export default boot(async ({ router }) => {
|
||||
router.afterEach((to) => {
|
||||
// Don't save login page as "last route"
|
||||
if (to.path !== '/login' && to.path !== '/') {
|
||||
localStorage.setItem('lastRoute', to.fullPath);
|
||||
setLocalLastRoute(to.fullPath);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user