blob: da6f398219de2b3902b52f934eefe7d3906a62b0 [file] [log] [blame]
Derick Montaguefded0d12019-12-11 06:16:40 -06001import Axios from 'axios';
Yoshie Muranaka74c24f12019-12-03 10:45:46 -08002
Yoshie Muranaka6ce1a072019-12-06 14:13:59 -08003const api = Axios.create({
4 withCredentials: true
5});
Yoshie Muranaka74c24f12019-12-03 10:45:46 -08006
Derick Montaguee080a1a2019-12-04 16:30:08 -06007// TODO: Permanent authentication solution
8// Using defaults to set auth for sending
9// auth object in header
Yoshie Muranaka74c24f12019-12-03 10:45:46 -080010
11export default {
12 get(path) {
13 return api.get(path);
14 },
15 delete(path, payload) {
16 return api.delete(path, payload);
17 },
18 post(path, payload) {
19 return api.post(path, payload);
20 },
21 patch(path, payload) {
22 return api.patch(path, payload);
23 },
24 put(path, payload) {
25 return api.put(path, payload);
26 },
27 all(promises) {
28 return Axios.all(promises);
Derick Montaguee080a1a2019-12-04 16:30:08 -060029 },
30 defaults: api.defaults
Yoshie Muranaka74c24f12019-12-03 10:45:46 -080031};