fix(qa): ISSUE-001 — leave the admin panel after logging out

Logging out on /admin cleared the session but left every admin form on
screen, because the requiresAdmin guard only runs on navigation. Route
to the login page once logOut() settles.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-19 19:51:29 +01:00
co-authored by Claude Opus 5.5
parent 66db14d0c5
commit 48e18ba67d
+7 -2
View File
@@ -6,6 +6,7 @@
* imported, since reaching this page means you want them. * imported, since reaching this page means you want them.
*/ */
import { ref, computed } from "vue"; import { ref, computed } from "vue";
import { useRouter } from "vue-router";
import { useAuthStore } from "@/stores/auth"; import { useAuthStore } from "@/stores/auth";
import Button from "@/components/input/Button.vue"; import Button from "@/components/input/Button.vue";
@@ -21,6 +22,7 @@ import ManageUsers from "./ManageUsers.vue";
import ManageRadio from "./ManageRadio.vue"; import ManageRadio from "./ManageRadio.vue";
const auth = useAuthStore(); const auth = useAuthStore();
const router = useRouter();
const sections = [ const sections = [
{ id: "user", label: "User", component: CreateUser }, { id: "user", label: "User", component: CreateUser },
@@ -40,8 +42,11 @@ const activeSection = computed(() =>
sections.find((s) => s.id === active.value), sections.find((s) => s.id === active.value),
); );
function handleLogout() { // The requiresAdmin guard only runs on navigation, so logging out in place
auth.logOut(); // would leave the panel on screen for a signed-out visitor; leave it instead.
async function handleLogout() {
await auth.logOut();
router.push("/admin/login");
} }
</script> </script>