Last change
on this file since 5528b99 was 5528b99, checked in by darsov2 <62809499+darsov2@…>, 9 months ago |
revert
|
-
Property mode
set to
100644
|
File size:
634 bytes
|
Rev | Line | |
---|
[e6c2521] | 1 | import axios from "axios";
|
---|
| 2 |
|
---|
| 3 | const instance = axios.create({
|
---|
| 4 | baseURL: "http://localhost:8080/",
|
---|
| 5 | withCredentials: true,
|
---|
[5528b99] | 6 | maxRedirects: 1
|
---|
[e6c2521] | 7 | })
|
---|
| 8 |
|
---|
[5528b99] | 9 | instance.interceptors.response.use(function (response) {
|
---|
| 10 | // Any status code that lie within the range of 2xx cause this function to trigger
|
---|
| 11 | // Do something with response data
|
---|
| 12 | return response;
|
---|
| 13 | }, function (error) {
|
---|
| 14 | console.log(error)
|
---|
| 15 | // window.location.href="/login"
|
---|
| 16 | // Any status codes that falls outside the range of 2xx cause this function to trigger
|
---|
| 17 | // Do something with response error
|
---|
| 18 | return Promise.reject(error);
|
---|
| 19 | });
|
---|
| 20 |
|
---|
[e6c2521] | 21 | export default instance |
---|
Note:
See
TracBrowser
for help on using the repository browser.