From 2fbcb9f918485f79ed9a37e3a7a23b6ea4db9d7a Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Wed, 22 Apr 2026 15:30:24 +0000 Subject: [PATCH] Add next value to signin page and actually use it --- ts/view/Authenticated.vue | 8 ++++++-- ts/view/Signin.vue | 9 +++++++-- ts/view/review/Site.vue | 6 +++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ts/view/Authenticated.vue b/ts/view/Authenticated.vue index fb9555ba..a8ff9637 100644 --- a/ts/view/Authenticated.vue +++ b/ts/view/Authenticated.vue @@ -25,6 +25,7 @@ import Sidebar from "@/components/layout/Sidebar.vue"; import MainContent from "@/components/layout/MainContent.vue"; import { Session } from "@/type/api"; import { router } from "@/route/config"; +import { useRoutes } from "@/route/use"; import { useSessionStore } from "@/store/session"; const session = useSessionStore(); @@ -35,8 +36,11 @@ onMounted(() => { console.log("session loaded by Authenticated", session); }) .catch((e) => { - console.log("root session not loaded", router); - router.push("/signin"); + console.log( + "root session not loaded, user is not authenticated", + router.currentRoute.value.fullPath, + ); + router.push(`/signin?next=${router.currentRoute.value.fullPath}`); }); }); diff --git a/ts/view/Signin.vue b/ts/view/Signin.vue index 66e2f45a..fb19ad44 100644 --- a/ts/view/Signin.vue +++ b/ts/view/Signin.vue @@ -33,7 +33,6 @@

Please enter your credentials

-
(""); const loading = ref(false); +const paramNext = useQueryParam("next"); const password = ref(""); const username = ref(""); async function doLogin() { @@ -125,7 +126,11 @@ async function doLogin() { password: password.value, username: username.value, }); - router.push("/"); + if (paramNext.value.value) { + router.push(paramNext.value.value); + } else { + router.push("/"); + } } catch (e) { console.log("login failed", e); error.value = `Login failed: ${e}`; diff --git a/ts/view/review/Site.vue b/ts/view/review/Site.vue index 5761e113..60dbde16 100644 --- a/ts/view/review/Site.vue +++ b/ts/view/review/Site.vue @@ -80,7 +80,7 @@ const mapFlyoverCamera = ref(new Camera()); const router = useRouter(); const storeSite = useStoreSite(); const selectedSiteID = ref(0); -const siteParam = useQueryParam("site"); +const paramSite = useQueryParam("site"); const submitting = ref(false); const selectedSite = computed((): Site | undefined => { if (!selectedSiteID.value) { @@ -148,7 +148,7 @@ function siteSelect(id: number): void { return; } mapFlyoverCamera.value = new Camera(site.address.location, 20); - siteParam.setValue(id.toString()); + paramSite.setValue(id.toString()); console.log("selecting site", id, site); } @@ -157,7 +157,7 @@ onMounted(async () => { storeSite.fetchAll(); }); watch( - siteParam.value, + paramSite.value, (site_id) => { if (site_id) { const id = parseInt(site_id, 10);