diff --git a/packages/frontend/src/apis/quiz.ts b/packages/frontend/src/apis/quiz.ts index 124b08dc..3c7e2c5d 100644 --- a/packages/frontend/src/apis/quiz.ts +++ b/packages/frontend/src/apis/quiz.ts @@ -1,5 +1,11 @@ import { API_PATH } from "../constants/path"; -import { Categories, Command, Quiz, QuizSolve } from "../types/quiz"; +import { + Categories, + Command, + Quiz, + QuizSolve, + SharedQuiz, +} from "../types/quiz"; import { instance } from "./base"; @@ -29,6 +35,12 @@ export const quizAPI = { const { data } = await instance.delete(`${API_PATH.QUIZZES}/${id}/command`); return data; }, + getSharedAnswer: async (slug: string) => { + const { data } = await instance.get( + `${API_PATH.QUIZZES}/shared?answer=${slug}`, + ); + return data; + }, }; type PostCommandRequest = { @@ -36,3 +48,8 @@ type PostCommandRequest = { mode: "command" | "editor"; message: string; }; + +export type GetSharedAnswerResponse = { + answer: string[]; + quiz: SharedQuiz; +}; diff --git a/packages/frontend/src/types/quiz.ts b/packages/frontend/src/types/quiz.ts index 9754aa7d..631b8f0a 100644 --- a/packages/frontend/src/types/quiz.ts +++ b/packages/frontend/src/types/quiz.ts @@ -17,6 +17,8 @@ export type Quiz = { answer: string[]; }; +export type SharedQuiz = Omit; + export type Quizzes = { id: number; category: string;