Add progress bar to top of page for nicer loading indicator styles

This commit is contained in:
Dane Everitt 2020-04-10 12:41:08 -07:00
parent 708c15eba8
commit d3a06e1ca8
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
12 changed files with 133 additions and 34 deletions

View file

@ -1,6 +1,8 @@
import axios, { AxiosInstance } from 'axios';
import { store } from '@/state';
const http: AxiosInstance = axios.create({
timeout: 20000,
headers: {
'X-Requested-With': 'XMLHttpRequest',
'Accept': 'application/json',
@ -9,6 +11,18 @@ const http: AxiosInstance = axios.create({
},
});
http.interceptors.request.use(req => {
store.getActions().progress.startContinuous();
return req;
});
http.interceptors.response.use(resp => {
store.getActions().progress.setComplete();
return resp;
});
// If we have a phpdebugbar instance registered at this point in time go
// ahead and route the response data through to it so things show up.
// @ts-ignore