Files
inkwell/frontend/src/router/index.ts
T
bvandeusenandClaude Opus 4.8 0f604f9a26
CI & Build / Python lint (push) Successful in 2s
CI & Build / TypeScript typecheck (push) Successful in 5s
CI & Build / Python tests (push) Successful in 8s
CI & Build / Build & push image (push) Successful in 30s
M1: masonry board UI — quick-add, note cards, editor, views
- notes Pinia store (load/create/pin/archive/color/trash/restore/delete) with
  view-aware reconcile; api client patch/del methods.
- colors.ts palette (10 keys → light/dark card + swatch tints).
- QuickAdd (collapsed → expand, title/body/color, click-outside/Esc to save),
  NoteCard (color tint, click-to-edit, hover action bar), NoteEditor modal,
  ColorPicker, inline Icon set (no icon dep).
- BoardView rewrite: Notes/Archive/Trash routes, CSS-columns masonry, Pinned +
  Others sections, per-view empty states, sign-out.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRgehjoz7Yv8LkUfADxACm
2026-07-19 16:08:53 -04:00

56 lines
1.4 KiB
TypeScript

import { createRouter, createWebHistory } from "vue-router";
import { useSessionStore } from "../stores/session";
const router = createRouter({
history: createWebHistory(),
routes: [
{
path: "/",
name: "board",
component: () => import("../views/BoardView.vue"),
meta: { requiresAuth: true },
},
{
path: "/archive",
name: "archive",
component: () => import("../views/BoardView.vue"),
meta: { requiresAuth: true },
},
{
path: "/trash",
name: "trash",
component: () => import("../views/BoardView.vue"),
meta: { requiresAuth: true },
},
{
path: "/login",
name: "login",
component: () => import("../views/LoginView.vue"),
meta: { guestOnly: true },
},
{
path: "/register",
name: "register",
component: () => import("../views/RegisterView.vue"),
meta: { guestOnly: true },
},
],
});
router.beforeEach(async (to) => {
const session = useSessionStore();
// Resolve the current user once, lazily, before the first guarded navigation.
if (!session.loaded) {
await session.fetchMe();
}
if (to.meta.requiresAuth && !session.user) {
return { name: "login", query: to.fullPath !== "/" ? { redirect: to.fullPath } : undefined };
}
if (to.meta.guestOnly && session.user) {
return { name: "board" };
}
return true;
});
export default router;