Add progress bar to top of page for nicer loading indicator styles
This commit is contained in:
parent
708c15eba8
commit
d3a06e1ca8
12 changed files with 133 additions and 34 deletions
|
@ -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
|
||||
|
|
Reference in a new issue