blob: d40ad0ad02574766f76e30d9156cc2e7da46507b [file] [log] [blame]
Yoshie Muranaka74c24f12019-12-03 10:45:46 -08001import Axios from "axios";
2
3const api = Axios.create();
4
5// TODO: this is a temporary workaround until
6// authentication with login is working
7const username = process.env.VUE_APP_USERNAME;
8const password = process.env.VUE_APP_PASSWORD;
9if (username && password) {
10 api.defaults.auth = {};
11 api.defaults.auth.username = username;
12 api.defaults.auth.password = password;
13}
14
15export default {
16 get(path) {
17 return api.get(path);
18 },
19 delete(path, payload) {
20 return api.delete(path, payload);
21 },
22 post(path, payload) {
23 return api.post(path, payload);
24 },
25 patch(path, payload) {
26 return api.patch(path, payload);
27 },
28 put(path, payload) {
29 return api.put(path, payload);
30 },
31 all(promises) {
32 return Axios.all(promises);
33 }
34};