user.api.js 709 Bytes
Newer Older
1
2
import axios from "axios";

Kim, Chaerin's avatar
merge19    
Kim, Chaerin committed
3
const getUser = async (id) => {
4

Kim, Chaerin's avatar
merge19    
Kim, Chaerin committed
5
6
7
8
  const { data } = await axios.get(`/api/getUser/${id}`);
  return data;
};

Kim, Chaerin's avatar
.    
Kim, Chaerin committed
9
const login = async (payload) => {
10
  const { data } = await axios.post("/api/login", payload);
11
12
13
  return data;
};

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

Kim, Chaerin's avatar
merge19    
Kim, Chaerin committed
19
20
21
22
23
24
25
26
27
28
29
const updateinfo = async (payload) => {
  const { data } = await axios.put("/api/updateinfo", payload);
  return data;
};

const profileimg = async (formData) => {
  const { data } = await axios.put("/api/profileimg", formData);
  return data;
};

const userApi = { login, signup, getUser, profileimg, updateinfo };
Kim, Chaerin's avatar
.    
Kim, Chaerin committed
30
31

export default userApi;