Skip to content

Commit

Permalink
Progress bar not showing on some pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mervekaraman committed Jul 7, 2023
1 parent 7a589e5 commit bffc926
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions resources/assets/js/bootstrap.js
Expand Up @@ -19,6 +19,38 @@ window.axios.defaults.headers.common['X-CSRF-TOKEN'] = window.Laravel.csrfToken;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
window.axios.defaults.headers.common['Content-Type'] = 'multipart/form-data';


// #start NProgress integration
// Added nprogress to use nprogress bar
import NProgress from "nprogress";

window.axios.interceptors.request.use(function (config) {
// Do something before request is sent
NProgress.start();

return config;
}, function (error) {
// Do something with request error
console.log(error);

return Promise.reject(error);
});

// Add a response interceptor
window.axios.interceptors.response.use(function (response) {
// Do something with response data
NProgress.done();

return response;
}, function (error) {
NProgress.done();
// Do something with response error
console.log(error);

return Promise.reject(error);
});
// #end NProgress integration

/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
Expand All @@ -33,3 +65,4 @@ window.axios.defaults.headers.common['Content-Type'] = 'multipart/form-data';
// broadcaster: 'pusher',
// key: 'your-pusher-key'
// });

0 comments on commit bffc926

Please sign in to comment.