Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame^] | 1 | import Axios from 'axios'; |
Yoshie Muranaka | 74c24f1 | 2019-12-03 10:45:46 -0800 | [diff] [blame] | 2 | |
Yoshie Muranaka | 6ce1a07 | 2019-12-06 14:13:59 -0800 | [diff] [blame] | 3 | const api = Axios.create({ |
| 4 | withCredentials: true |
| 5 | }); |
Yoshie Muranaka | 74c24f1 | 2019-12-03 10:45:46 -0800 | [diff] [blame] | 6 | |
Derick Montague | e080a1a | 2019-12-04 16:30:08 -0600 | [diff] [blame] | 7 | // TODO: Permanent authentication solution |
| 8 | // Using defaults to set auth for sending |
| 9 | // auth object in header |
Yoshie Muranaka | 74c24f1 | 2019-12-03 10:45:46 -0800 | [diff] [blame] | 10 | |
| 11 | export 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 Montague | e080a1a | 2019-12-04 16:30:08 -0600 | [diff] [blame] | 29 | }, |
| 30 | defaults: api.defaults |
Yoshie Muranaka | 74c24f1 | 2019-12-03 10:45:46 -0800 | [diff] [blame] | 31 | }; |