Fix duplicate navigation error
Adding a check to the 403 response api iterceptor before routing to the
Unauthorized page. The router throws a NavigationDuplicated error when
attempting to navigate to the same page.
Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: Ib34d4d73a326440f609dd97d0dd677ff96b7b3a6
diff --git a/src/store/api.js b/src/store/api.js
index c8f1eda..4a8b8e8 100644
--- a/src/store/api.js
+++ b/src/store/api.js
@@ -19,6 +19,13 @@
}
if (response.status == 403) {
+ if (router.history.current.name === 'unauthorized') {
+ // Check if current router location is unauthorized
+ // to avoid NavigationDuplicated errors.
+ // The router throws an error if trying to push to the
+ // same/current router location.
+ return;
+ }
router.push({ name: 'unauthorized' });
}