fix teacher, parent and admin pages

This commit is contained in:
root
2026-04-25 00:00:10 -04:00
parent 7fe34dde0d
commit 3e77fc92c7
275 changed files with 46412 additions and 3325 deletions
+49
View File
@@ -0,0 +1,49 @@
/**
* Password reset / initial set-password flows (legacy CI `user/*` auth views).
* Backend expected under `/api/v1/auth/...`.
*/
import { apiFetch } from './http'
export async function requestForgotPassword(email: string): Promise<{ ok?: boolean; message?: string }> {
return apiFetch('/api/v1/auth/forgot-password', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email: email.trim() }),
})
}
export async function submitPasswordReset(payload: {
token: string
password: string
pass_confirm: string
}): Promise<{ ok?: boolean; message?: string }> {
return apiFetch('/api/v1/auth/reset-password', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
})
}
export async function submitSetPassword(payload: {
user_id: number | string
token: string
password: string
password_confirm: string
}): Promise<{ ok?: boolean; message?: string }> {
return apiFetch('/api/v1/auth/set-password', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
})
}
export async function submitAuthorizedUserPassword(
userId: number | string,
payload: { token: string; password: string; password_confirm: string },
): Promise<{ ok?: boolean; message?: string }> {
return apiFetch(`/api/v1/auth/set-authorized-user-password/${encodeURIComponent(String(userId))}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
})
}