Browse Source

Replace alert with redirect

pull/1230/head
Hironsan 3 years ago
parent
commit
c8c8584499
2 changed files with 6 additions and 2 deletions
  1. 6
      frontend/middleware/check-admin.js
  2. 2
      frontend/store/projects.js

6
frontend/middleware/check-admin.js

@ -1,5 +1,9 @@
export default async function({ app, store, route, redirect }) { 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 role = store.getters['projects/getCurrentUserRole']
const projectRoot = app.localePath('/projects/' + route.params.id) const projectRoot = app.localePath('/projects/' + route.params.id)
const path = route.fullPath.replace(/\/$/g, '') const path = route.fullPath.replace(/\/$/g, '')

2
frontend/store/projects.js

@ -330,7 +330,7 @@ export const actions = {
commit('setCurrent', response.data) commit('setCurrent', response.data)
}) })
.catch((error) => { .catch((error) => {
alert(error)
throw new Error(error)
}) })
}, },
updateCurrentProject({ commit }, data) { updateCurrentProject({ commit }, data) {

Loading…
Cancel
Save