implemented

This commit is contained in:
counterweight 2025-12-20 23:06:05 +01:00
parent a31bd8246c
commit d3638e2e69
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
18 changed files with 1643 additions and 120 deletions

View file

@ -3,8 +3,11 @@
import { createContext, useContext, useState, useEffect, useCallback, ReactNode } from "react";
import { api, ApiError } from "./api";
import { components } from "./generated/api";
// Permission constants matching backend
// Permission constants - must match backend/models.py Permission enum.
// Backend exposes these via GET /api/meta/constants for validation.
// TODO: Generate this from the backend endpoint at build time.
export const Permission = {
VIEW_COUNTER: "view_counter",
INCREMENT_COUNTER: "increment_counter",
@ -16,12 +19,8 @@ export const Permission = {
export type PermissionType = typeof Permission[keyof typeof Permission];
interface User {
id: number;
email: string;
roles: string[];
permissions: string[];
}
// Use generated type from OpenAPI schema
type User = components["schemas"]["UserResponse"];
interface AuthContextType {
user: User | null;