next-app/app/lib/session.ts
Alex Stan 43db39291e added a dynamic category page
Signed-off-by: Alex Stan <alex.stan.2010@proton.me>
2024-06-01 17:40:03 +03:00

24 lines
No EOL
517 B
TypeScript

import { makeGetRequest, makePostRequest } from "./api";
export type Session = {
id: number;
right: number;
wrong: number;
total: number;
// user: string;
}
export type SessionState = {
answered: number;
wrong: number;
right: number;
category: string;
}
export const getSession = async (id: number): Promise<Session> => {
return makeGetRequest( `sessions/${id}/` );
}
export const postSession = async (session: Session): Promise<Session> => {
return makePostRequest( `sessions`, session );
}