M1: minimal board UI (login, board, cartable)
A functional React/Vite SPA exercising the M1 API end-to-end: - Zustand auth store (persisted JWT) + a small fetch client that attaches the bearer token and logs out on 401. - LoginPage: sign in, or bootstrap the first owner on first run. - BoardPage: set org name, create/select a team, create tasks, move them across the backlog -> in progress -> in review -> done columns, assign to me, and a cartable panel. - React Router guards routes on the presence of a token. Mirrors the integration-tested API contracts exactly. Compiles clean (tsc + vite); still needs a manual click-through (run the web host + Postgres, or `docker compose up --build`). dnd-kit drag, TanStack Query, and an orval-generated typed client are M1+ polish — buttons/selects drive task moves for now. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { create } from 'zustand'
|
||||
import { persist } from 'zustand/middleware'
|
||||
|
||||
interface AuthState {
|
||||
token: string | null
|
||||
memberId: string | null
|
||||
organizationId: string | null
|
||||
setAuth: (token: string, memberId: string, organizationId: string | null) => void
|
||||
logout: () => void
|
||||
}
|
||||
|
||||
export const useAuth = create<AuthState>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
token: null,
|
||||
memberId: null,
|
||||
organizationId: null,
|
||||
setAuth: (token, memberId, organizationId) => set({ token, memberId, organizationId }),
|
||||
logout: () => set({ token: null, memberId: null, organizationId: null }),
|
||||
}),
|
||||
{ name: 'teamup-auth' },
|
||||
),
|
||||
)
|
||||
Reference in New Issue
Block a user