question.api.ts 728 Bytes
Newer Older
Jiwon Yoon's avatar
Jiwon Yoon committed
1
import axios from "axios";
Jiwon Yoon's avatar
Jiwon Yoon committed
2
import { BasicQuestionType } from "../types";
Jiwon Yoon's avatar
Jiwon Yoon committed
3
4
5
import baseUrl from "./baseUrl";

export const createQuestion = async () => {
Jiwon Yoon's avatar
Jiwon Yoon committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  const { data } = await axios.post(`${baseUrl}/questions/create`, {
    type: "essay",
    title: "Question Title",
    isRequired: false,
    comment: "질문에 대한 설명을 입력해주세요",
    content: { choices: [] },
  });
  return data;
};

export const updateQuestion = async (question: BasicQuestionType) => {
  const { data } = await axios.post(`${baseUrl}/questions/update`, question);
  return data;
};

export const deleteQuestion = async (id: string) => {
  const { data } = await axios.post(`${baseUrl}/questions/delete`, { id: id });
  return data;
};