feat(pages): add pretest screen
This commit is contained in:
@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user