feat: add collaborative shopping lists with items and invitations
Some checks failed
CI / Verify (push) Has been cancelled
Some checks failed
CI / Verify (push) Has been cancelled
API: lists, items and invitations modules (list, create, get, update, set-primary, items create/list, invitation create/accept/list-pending), BetterAuth session helper, list membership, mailer and Prisma schema plus migrations. Web: lists overview, list detail (items) and list management (settings) views, item and invitation forms/hooks, sign-up and invitation accept pages. Shared: shopping list DTOs. Tooling: ignore the generated TanStack Router cache (apps/web/.tanstack).
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { createFileRoute, Navigate, Outlet } from '@tanstack/react-router'
|
||||
import { createFileRoute, Navigate, Outlet, useRouterState } from '@tanstack/react-router'
|
||||
|
||||
import { AppHeader } from '@/components/layout/app-header'
|
||||
import { AppSidebar } from '@/components/layout/app-sidebar'
|
||||
@@ -13,17 +13,18 @@ export const Route = createFileRoute('/_authenticated')({
|
||||
/**
|
||||
* Layout for every authenticated page. The session lives in BetterAuth (Hono
|
||||
* API); while it resolves we render a loader, and without a session we bounce
|
||||
* the user to `/sign-in`.
|
||||
* the user to `/sign-in`, keeping the current URL so we can return after login.
|
||||
*/
|
||||
function AuthenticatedLayout() {
|
||||
const { data: session, isPending } = useSession()
|
||||
const href = useRouterState({ select: (state) => state.location.href })
|
||||
|
||||
if (isPending) {
|
||||
return <SessionLoading />
|
||||
}
|
||||
|
||||
if (!session) {
|
||||
return <Navigate to="/sign-in" replace />
|
||||
return <Navigate to="/sign-in" search={{ redirect: href }} replace />
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user