-
Notifications
You must be signed in to change notification settings - Fork 472
Expand file tree
/
Copy pathapi.js
More file actions
21 lines (17 loc) · 586 Bytes
/
api.js
File metadata and controls
21 lines (17 loc) · 586 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import axios from 'axios';
export const fetchContest = contestId => {
return axios.get(`/api/contests/${contestId}`)
.then(resp => resp.data);
};
export const fetchContestList = () => {
return axios.get('/api/contests')
.then(resp => resp.data.contests);
};
export const fetchNames = nameIds => {
return axios.get(`/api/names/${nameIds.join(',')}`)
.then(resp => resp.data.names);
};
export const addName = (newName, contestId) => {
return axios.post('/api/names', { newName, contestId })
.then(resp => resp.data);
};