implemented
This commit is contained in:
parent
a31bd8246c
commit
d3638e2e69
18 changed files with 1643 additions and 120 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue