next-app/app/lib/session.ts

17 lines
411 B
TypeScript
Raw Permalink Normal View History

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 );
}