Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/" 오류 해결
2020. 10. 2. 23:06
How to solve Avoided redundant navigation to current location error in vue?
I am new in vue and i got the error after user logged in and redirect to another route. Basically i am a PHP developer and i use laravel with vue. Please help me to solve this error. Uncaught (in
stackoverflow.com
로그인하고 다시 로그아웃을 누르면 크롬 개발자 모드에서 뜨는 오류였다
Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/"
1
2
3
4
5
6
7
8
9
10
11
|
export default {
...
methods: {
logout() {
...
this.$router.replace("/");
})
...
}
...
}
|
cs |
6번째 줄 보면 로그아웃 시 메인 페이지로 돌아갈 때 예외처리를 안해준 것이 문제였다
1
2
3
4
5
6
7
8
9
10
11
|
export default {
...
methods: {
logout() {
...
this.$router.replace("/").catch(() => {});
})
...
}
...
}
|
cs |
위처럼 수정해주니 더이상 위의 오류는 뜨지 않았다