feat(pages): add pretest screen

This commit is contained in:
shafin-r
2026-01-22 19:15:22 +06:00
parent d5a39add17
commit 61b7c5220e
12 changed files with 572 additions and 25 deletions

View File

@ -1,3 +1,5 @@
import type { PracticeSheet } from "../types/sheet";
const API_URL = "https://ed-dev-api.omukk.dev";
export interface LoginRequest {
@ -36,7 +38,7 @@ class ApiClient {
private async request<T>(
endpoint: string,
options: RequestInit = {}
options: RequestInit = {},
): Promise<T> {
const url = `${this.baseURL}${endpoint}`;
@ -79,7 +81,7 @@ class ApiClient {
async authenticatedRequest<T>(
endpoint: string,
token: string,
options: RequestInit = {}
options: RequestInit = {},
): Promise<T> {
return this.request<T>(endpoint, {
...options,
@ -98,7 +100,7 @@ class ApiClient {
async getPracticeSheets(
token: string,
page: number,
limit: number
limit: number,
): Promise<any> {
const queryParams = new URLSearchParams({
page: page.toString(),
@ -106,12 +108,18 @@ class ApiClient {
}).toString();
return this.authenticatedRequest<any>(
`/practice-sheets/?${queryParams}`,
token
token,
);
}
async getSatDates(token: string): Promise<any> {
return this.authenticatedRequest<any>(`/sat-dates/`, token);
async getPracticeSheetById(
token: string,
sheetId: string,
): Promise<PracticeSheet> {
return this.authenticatedRequest<PracticeSheet>(
`/practice-sheets/${sheetId}`,
token,
);
}
}