Skip to content

Commit

Permalink
feat: 공유 답안 조회 API 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
YuHyun-P authored and flydog98 committed Dec 14, 2023
1 parent bfa5157 commit d33bca8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/frontend/src/apis/quiz.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -29,10 +35,21 @@ export const quizAPI = {
const { data } = await instance.delete(`${API_PATH.QUIZZES}/${id}/command`);
return data;
},
getSharedAnswer: async (slug: string) => {
const { data } = await instance.get<GetSharedAnswerResponse>(
`${API_PATH.QUIZZES}/shared?answer=${slug}`,
);
return data;
},
};

type PostCommandRequest = {
id: number;
mode: "command" | "editor";
message: string;
};

export type GetSharedAnswerResponse = {
answer: string[];
quiz: SharedQuiz;
};
2 changes: 2 additions & 0 deletions packages/frontend/src/types/quiz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export type Quiz = {
answer: string[];
};

export type SharedQuiz = Omit<Quiz, "answer">;

export type Quizzes = {
id: number;
category: string;
Expand Down

0 comments on commit d33bca8

Please sign in to comment.