mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-14 04:13:46 +02:00
Add progress bar to top of page for nicer loading indicator styles
This commit is contained in:
@@ -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 New Issue
Block a user