From c8c8584499bd7e257ae1db93a62f2cd071ec30ca Mon Sep 17 00:00:00 2001 From: Hironsan Date: Wed, 3 Mar 2021 17:42:44 +0900 Subject: [PATCH] Replace alert with redirect --- frontend/middleware/check-admin.js | 6 +++++- frontend/store/projects.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/middleware/check-admin.js b/frontend/middleware/check-admin.js index d6ed7ffa..c4168a2e 100644 --- a/frontend/middleware/check-admin.js +++ b/frontend/middleware/check-admin.js @@ -1,5 +1,9 @@ export default async function({ app, store, route, redirect }) { - await store.dispatch('projects/setCurrentProject', route.params.id) + try { + await store.dispatch('projects/setCurrentProject', route.params.id) + } catch(e) { + redirect('/projects') + } const role = store.getters['projects/getCurrentUserRole'] const projectRoot = app.localePath('/projects/' + route.params.id) const path = route.fullPath.replace(/\/$/g, '') diff --git a/frontend/store/projects.js b/frontend/store/projects.js index 48d057c0..b2318559 100644 --- a/frontend/store/projects.js +++ b/frontend/store/projects.js @@ -330,7 +330,7 @@ export const actions = { commit('setCurrent', response.data) }) .catch((error) => { - alert(error) + throw new Error(error) }) }, updateCurrentProject({ commit }, data) {