Repository navigation
How To Import Router !! #460
Unanswered
khaledOghli
asked this question in
Q&A
Replies: 2 comments
if could you help me please @antfu |
0 replies
|
maybe it's not the best way ,but this what i did : |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hello Guys
Please if someone help me how to import router to make router.push(path) from api.js
I'm not able to figure out how to make it.
my example : where need to import router.
APIWrapper.js
api.interceptors.response.use(null, error => { let path = '/error'; switch (error.response.status) { case 401: path = '/login'; break; case 404: path = '/404'; break; } router.push(path); return Promise.reject(error); });Many Thanks.
All reactions