DONE: layout letter with letterhead and footer, notification for newly...

This commit is contained in:
ISMAIL MASSERAN
2026-06-28 02:16:49 +00:00
parent 94ecbe5887
commit 034ecf947f
400 changed files with 29802 additions and 5446 deletions
@@ -1,12 +1,16 @@
import { api } from '@/core/services/api'
import { getApiErrorMessage } from '@/core/utils/getApiErrorMessage'
import type {
ForgotPasswordPayload,
ForgotPasswordResponse,
LoginCredentials,
LoginResponse,
LoginVerificationRequiredData,
RegisterCredentials,
RegisterResponse,
ResendVerificationResponse,
ResetPasswordPayload,
ResetPasswordResponse,
SessionResponse,
SwitchRoleResponse,
VerifyEmailPayload,
@@ -33,6 +37,20 @@ export async function resendVerificationEmail(email: string): Promise<ResendVeri
return data
}
export async function requestForgotPassword(
payload: ForgotPasswordPayload,
): Promise<ForgotPasswordResponse> {
const { data } = await api.post<ForgotPasswordResponse>('/forgot-password', payload)
return data
}
export async function resetPassword(
payload: ResetPasswordPayload,
): Promise<ResetPasswordResponse> {
const { data } = await api.post<ResetPasswordResponse>('/reset-password', payload)
return data
}
export async function fetchCurrentUser(): Promise<SessionResponse> {
const { data } = await api.get<SessionResponse>('/v1/me')
return data
@@ -59,6 +77,14 @@ export function getVerifyEmailErrorMessage(error: unknown): string {
return getApiErrorMessage(error, 'Email verification failed. Please try again.')
}
export function getForgotPasswordErrorMessage(error: unknown): string {
return getApiErrorMessage(error, 'Gagal menghantar kod OTP. Sila cuba lagi.')
}
export function getResetPasswordErrorMessage(error: unknown): string {
return getApiErrorMessage(error, 'Gagal menetapkan semula kata laluan. Sila cuba lagi.')
}
export function isAccountPending(user: { status: string } | null | undefined): boolean {
return user?.status === 'pending'
}