room.api.js 1.3 KB
Newer Older
1
2
import axios from "axios";

Kim, Chaerin's avatar
merge19    
Kim, Chaerin committed
3
const getRoom = async (id) => {
4
  const { data } = await axios.post("/api/room/getRoom", id);
Kim, Chaerin's avatar
merge19    
Kim, Chaerin committed
5
6
7
  return data;
};

우지원's avatar
우지원 committed
8
const exitRoom = async (ID) => {
9
10
11
  const { data } = await axios.delete(
    `/api/room/exitRoom/${ID.id}/${ID.roomId}`
  );
우지원's avatar
우지원 committed
12
13
14
  return data;
};

Kim, Chaerin's avatar
Kim, Chaerin committed
15
16
const create = async (formData) => {
  const { data } = await axios.post("/api/room/create", formData);
17
18
19
  return data;
};

우지원's avatar
e    
우지원 committed
20
21
const join = async (payload) => {
  const { data } = await axios.put("/api/room/join", payload);
22
23
24
  return data;
};

권병윤's avatar
0806    
권병윤 committed
25
const changename = async (payload) => {
26
  const { data } = await axios.put("/api/room/changename", payload);
권병윤's avatar
0806    
권병윤 committed
27
  return data;
28
};
권병윤's avatar
0806    
권병윤 committed
29

30
const joinChannel = async (payload) => {
우지원's avatar
0805    
우지원 committed
31
  const { data } = await axios.post("/api/room/joinChannel", payload);
32
33
34
  return data;
};

우지원's avatar
우지원 committed
35
36
const doubleJoin = async (payload) => {
  const { data } = await axios.post("/api/room/doubleJoin", payload);
우지원's avatar
0805    
우지원 committed
37
38
39
  return data;
};

이재연's avatar
이재연 committed
40
41
42
43
44
45
46
const removeRoom = async (ID)=>{
  const { data } = await axios.delete(
    `/api/room/removeRoom/${ID.roomId}`
  );
  return data;
}

우지원's avatar
우지원 committed
47
48
49
50
51
// const makeChannel = async (payload) => {
//   const { data } = await axios.post("/api/room/makeChannel", payload);
//   return data;
// };

52
53
54
55
56
57
58
59
const roomApi = {
  getRoom,
  exitRoom,
  create,
  join,
  changename,
  joinChannel,
  doubleJoin,
이재연's avatar
이재연 committed
60
  removeRoom
61
};
62
63

export default roomApi;