Browse Source

Update middleware to prevent calling method many times

pull/1242/head
Hironsan 3 years ago
parent
commit
c1ecd0ea5f
1 changed files with 4 additions and 2 deletions
  1. 6
      frontend/middleware/check-admin.js

6
frontend/middleware/check-admin.js

@ -1,4 +1,6 @@
export default async function({ app, store, route, redirect }) {
import _ from 'lodash'
export default _.debounce(async function({ app, store, route, redirect }) {
try {
await store.dispatch('projects/setCurrentProject', route.params.id)
} catch(e) {
@ -10,4 +12,4 @@ export default async function({ app, store, route, redirect }) {
if (!role.is_project_admin && path !== projectRoot) {
return redirect(projectRoot)
}
}
}, 1000)
Loading…
Cancel
Save