As with axios.interceptors.response to catch 403 error and show modelku with a warning?

0 like 0 dislike
4 views
How can I make so that when the 403 error was modelka with a warning?
Use
axios.interceptors.response.use((response) => { return response }, (error) => { if (error.response.status == 401) { localStorage.removeItem('token') router.push({ path: '/login' }) } return Promise.reject(error) })


for catching errors.
Using axios, vue.js vue-router. Show any of modelki I have made so that she was transferred to St.-in date modal = true and it showed.
by | 4 views

1 Answer

0 like 0 dislike
Vuex there? Create a common state type:
modals: { 403: false }

Throw modelku in the App.vue to all pages. Broadcast on modelco
...


Profit!

P. S If vuex nope and have no desire to use (in vain), it is possible to do using $root.
by

Related questions

0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
33,650 users