Initial commit
This commit is contained in:
56
frontend/src/types/index.ts
Normal file
56
frontend/src/types/index.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
export type UserPermissions = Record<string, boolean>;
|
||||
|
||||
export interface User {
|
||||
id: string;
|
||||
username: string;
|
||||
email: string;
|
||||
is_active: boolean;
|
||||
is_superuser: boolean;
|
||||
permissions: UserPermissions;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
last_login: string | null;
|
||||
}
|
||||
|
||||
export interface LoginRequest {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface RegisterRequest {
|
||||
username: string;
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface UserCreate {
|
||||
username: string;
|
||||
email: string;
|
||||
password: string;
|
||||
is_active?: boolean;
|
||||
is_superuser?: boolean;
|
||||
permissions?: UserPermissions;
|
||||
}
|
||||
|
||||
export interface UserUpdatePayload {
|
||||
username?: string;
|
||||
email?: string;
|
||||
password?: string;
|
||||
is_active?: boolean;
|
||||
is_superuser?: boolean;
|
||||
permissions?: UserPermissions;
|
||||
}
|
||||
|
||||
export interface Token {
|
||||
access_token: string;
|
||||
token_type: string;
|
||||
}
|
||||
|
||||
export interface AuthContextType {
|
||||
user: User | null;
|
||||
token: string | null;
|
||||
login: (username: string, password: string) => Promise<void>;
|
||||
register: (username: string, email: string, password: string) => Promise<void>;
|
||||
logout: () => void;
|
||||
isLoading: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user