add new event and attendance table with automatic now timestamp
All checks were successful
Build Quasar SPA and Go Backend for memberApp / build-spa (push) Successful in 2m34s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, .exe, windows) (push) Successful in 5m39s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, , linux) (push) Successful in 5m46s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm, 6, , linux) (push) Successful in 5m32s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm64, , linux) (push) Successful in 5m35s
All checks were successful
Build Quasar SPA and Go Backend for memberApp / build-spa (push) Successful in 2m34s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, .exe, windows) (push) Successful in 5m39s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, , linux) (push) Successful in 5m46s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm, 6, , linux) (push) Successful in 5m32s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm64, , linux) (push) Successful in 5m35s
This commit is contained in:
@@ -16,7 +16,7 @@ export default boot(async ({ app }) => {
|
||||
.then((resp) => {
|
||||
useStore
|
||||
.setUser({ id: resp.data.id, username: resp.data.username, role: resp.data.role })
|
||||
.catch((err) => console.log(err));
|
||||
.catch((err) => console.error(err));
|
||||
login.refresh().catch((err) => console.error(err));
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
32
src/boot/restore-route.js
Normal file
32
src/boot/restore-route.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import { boot } from 'quasar/wrappers';
|
||||
import { useUserStore } from 'src/vueLib/login/userStore';
|
||||
|
||||
export default boot(async ({ router }) => {
|
||||
const userStore = useUserStore();
|
||||
|
||||
// Restore logic after router is ready but before navigation
|
||||
router.isReady().then(() => {
|
||||
const lastRoute = sessionStorage.getItem('lastRoute');
|
||||
const currentPath = router.currentRoute.value.fullPath;
|
||||
|
||||
// Restore only if:
|
||||
// - we’re on root ("/" or "/#/"), and
|
||||
// - a last route exists, and
|
||||
// - the user is authenticated
|
||||
if (
|
||||
lastRoute &&
|
||||
['/', '/#/', '/#/index.html'].includes(currentPath) &&
|
||||
userStore.isAuthenticated
|
||||
) {
|
||||
router.replace(lastRoute).catch(() => {});
|
||||
}
|
||||
});
|
||||
|
||||
// Save the route after every successful navigation
|
||||
router.afterEach((to) => {
|
||||
// Don't save login page as "last route"
|
||||
if (to.path !== '/login' && to.path !== '/') {
|
||||
sessionStorage.setItem('lastRoute', to.fullPath);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user