From b706fbcfda3ec0884ff604fcb025b448d28217aa Mon Sep 17 00:00:00 2001 From: Oleksandr Strakhov Date: Mon, 18 May 2020 12:39:40 +0300 Subject: [PATCH] Handle routing exceptions --- frontend/src/App.vue | 2 +- frontend/src/components/common/Navbar.vue | 2 +- frontend/src/components/common/TweetPreviewList.vue | 2 +- frontend/src/components/view/tweet/TweetContainer.vue | 2 +- frontend/src/views/SignIn.vue | 2 +- frontend/src/views/SignUp.vue | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index ca26b55d..2ac245d9 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -37,7 +37,7 @@ export default { created() { EventEmitter.$on(TOKEN_EXPIRED_EVENT, () => { this.logout(); - this.$router.push({ name: 'auth.signIn' }); + this.$router.push({ name: 'auth.signIn' }).catch(() => {}); }); }, diff --git a/frontend/src/components/common/Navbar.vue b/frontend/src/components/common/Navbar.vue index 29c56897..c229fa94 100644 --- a/frontend/src/components/common/Navbar.vue +++ b/frontend/src/components/common/Navbar.vue @@ -135,7 +135,7 @@ export default { async onSignOut() { await this.signOut(); - this.$router.push({ name: 'auth.signIn' }); + this.$router.push({ name: 'auth.signIn' }).catch(() => {}); }, toggleMobileMenu() { diff --git a/frontend/src/components/common/TweetPreviewList.vue b/frontend/src/components/common/TweetPreviewList.vue index ce3c60b2..86e934c4 100644 --- a/frontend/src/components/common/TweetPreviewList.vue +++ b/frontend/src/components/common/TweetPreviewList.vue @@ -38,7 +38,7 @@ export default { methods: { onTweetClick(tweet) { - this.$router.push({ name: 'tweet-page', params: { id: tweet.id } }); + this.$router.push({ name: 'tweet-page', params: { id: tweet.id } }).catch(() => {}); }, infiniteHandler($state) { diff --git a/frontend/src/components/view/tweet/TweetContainer.vue b/frontend/src/components/view/tweet/TweetContainer.vue index 01bf8f60..c955f687 100644 --- a/frontend/src/components/view/tweet/TweetContainer.vue +++ b/frontend/src/components/view/tweet/TweetContainer.vue @@ -188,7 +188,7 @@ export default { this.showSuccessMessage('Tweet deleted!'); - this.$router.push({ name: 'feed' }); + this.$router.push({ name: 'feed' }).catch(() => {}); } catch { this.showErrorMessage('Unable to delete tweet!'); } diff --git a/frontend/src/views/SignIn.vue b/frontend/src/views/SignIn.vue index 36b1b94f..32c39275 100644 --- a/frontend/src/views/SignIn.vue +++ b/frontend/src/views/SignIn.vue @@ -77,7 +77,7 @@ export default { .then(() => { this.showSuccessMessage('Welcome!'); - this.$router.push({ path: '/' }); + this.$router.push({ path: '/' }).catch(() => {}); }) .catch(error => this.showErrorMessage(error.message)); }, diff --git a/frontend/src/views/SignUp.vue b/frontend/src/views/SignUp.vue index e120b5bd..77898eb8 100644 --- a/frontend/src/views/SignUp.vue +++ b/frontend/src/views/SignUp.vue @@ -101,7 +101,7 @@ export default { .then(() => { this.showSuccessMessage('Welcome!'); - this.$router.push({ path: '/' }); + this.$router.push({ path: '/' }).catch(() => {}); }) .catch(error => this.showErrorMessage(error.message)); },