Fix check-auth middleware

This commit is contained in:
Julien Nahum 2023-10-27 10:58:01 +01:00
parent 437644584a
commit 7eb546703f
4 changed files with 327 additions and 616 deletions

925
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -39,13 +39,11 @@
<script> <script>
import { inputProps, useFormInput } from './useFormInput.js' import { inputProps, useFormInput } from './useFormInput.js'
import InputLabel from './components/InputLabel.vue'
import InputHelp from './components/InputHelp.vue'
import InputWrapper from './components/InputWrapper.vue' import InputWrapper from './components/InputWrapper.vue'
export default { export default {
name: 'TextInput', name: 'TextInput',
components: { InputWrapper, InputHelp, InputLabel }, components: { InputWrapper },
props: { props: {
...inputProps, ...inputProps,

View File

@ -41,11 +41,12 @@ export default async (to, from, next) => {
store.getters['auth/token'] !== undefined store.getters['auth/token'] !== undefined
) { ) {
try { try {
const user = await store.dispatch('auth/fetchUser') store.dispatch('auth/fetchUser').then((user) => {
initCrisp(user) initCrisp(user)
initSentry(user) initSentry(user)
})
} catch (e) { } catch (e) {
console.log(e, 'error') console.error(e)
} }
} }
next() next()

View File

@ -1,7 +1,7 @@
import store from '~/store' import store from '~/store'
export default async (to, from, next) => { export default async (to, from, next) => {
/* if (store.getters['auth/check'] && store.getters['auth/user'].workspaces_count === 0) { if (store.getters['auth/check'] && store.getters['auth/user'].workspaces_count === 0) {
if ([ if ([
'forms.create', 'forms.create',
'forms.show', 'forms.show',
@ -10,8 +10,9 @@ export default async (to, from, next) => {
].includes(to.name) ].includes(to.name)
) { ) {
next({ name: 'onboarding' }) next({ name: 'onboarding' })
return
} }
}*/ }
next() next()
} }