subject.api.js 785 Bytes
Newer Older
1
import axios from "axios";
Kim, Subin's avatar
Kim, Subin committed
2
import baseUrl from "../utils/baseUrl.js";
3

4
5
6
const addsubject = async (info, userId) => {
  console.log('subject check', userId)
  // info.user = userId;
Kim, Subin's avatar
Kim, Subin committed
7
  const url = `${baseUrl}/api/subject/addsubject`;
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  const { data } = await axios.post(url, { info, userId });
  return data
}

const editSubject = async (info, id) => {
  console.log("editSubject check", info, ',', id)
  const url = `${baseUrl}/api/subject/editsubject`
  const { data } = await axios.post(url, { info, id })
  return data
}

const getSubInfo = async (info) => {
  console.log('info', info)
  const url = `${baseUrl}/api/subject/${info}`
  const { data } = await axios.get(url);
  return data
24
}
Kim, Subin's avatar
Kim, Subin committed
25

26
const subjectApi = {
27
28
29
  addsubject,
  getSubInfo,
  editSubject
30
31
32
};

export default subjectApi