next-app/app/lib/session.ts
Alex Stan 882dd995f9 Added the question and session api and a form component
Signed-off-by: Alex Stan <90788596+Ultra980@users.noreply.github.com>
2024-06-01 15:13:30 +03:00

17 lines
411 B
TypeScript

import { makeGetRequest, makePostRequest } from "./api";
export type Session = {
id: number;
right: number;
wrong: number;
total: number;
// user: 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 );
}