Public Access
feat: Implement API modules for admin, auth, exam, result, and setup functionalities
- Created adminApi.ts for admin-related operations including user management and site settings. - Developed authApi.ts for authentication processes such as registration, login, and profile management. - Added examApi.ts for handling exam CRUD operations. - Introduced resultApi.ts for managing results submission and retrieval. - Established setupApi.ts for initial setup processes and status checks. - Created ErrorBoundary component to handle rendering errors gracefully in the frontend. - Re-exported shared API utilities in index.ts for easier access.
This commit is contained in:
1 parent
62af83ce53
commit
c64cdcd9e3
46 files changed
+2227
-1125
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { apiFetch } from '../utils/api.js'
|
||||
|
||||
export interface SetupStatus {
|
||||
completed: boolean
|
||||
siteTitle?: string
|
||||
}
|
||||
|
||||
export function getSetupStatus(): Promise<SetupStatus> {
|
||||
return apiFetch('/api/setup/status')
|
||||
}
|
||||
|
||||
export interface SetupPayload {
|
||||
email: string
|
||||
password: string
|
||||
displayName: string
|
||||
smtpHost?: string
|
||||
smtpPort?: string
|
||||
smtpUser?: string
|
||||
smtpPass?: string
|
||||
smtpFrom?: string
|
||||
smtpSecure?: string
|
||||
appUrl?: string
|
||||
}
|
||||
|
||||
export interface SetupResponse {
|
||||
message: string
|
||||
token: string
|
||||
user: {
|
||||
id: number
|
||||
email: string
|
||||
displayName: string
|
||||
role: 'user' | 'admin'
|
||||
}
|
||||
}
|
||||
|
||||
export function completeSetup(data: SetupPayload): Promise<SetupResponse> {
|
||||
return apiFetch('/api/setup', { method: 'POST', body: JSON.stringify(data) })
|
||||
}
|
||||
Reference in new issue
Block a user