1
0

fix: introduce a ListView type to properly type all available list views

This commit is contained in:
kolaente
2022-09-08 14:11:19 +02:00
parent d91d1fecf1
commit 23598dd2ee
3 changed files with 20 additions and 13 deletions

View File

@ -41,6 +41,7 @@ import {useTitle} from '@vueuse/core'
import Message from '@/components/misc/message.vue'
import {LOGO_VISIBLE} from '@/store/mutation-types'
import {LIST_VIEWS, type ListView} from '@/types/ListView'
const {t} = useI18n({useScope: 'global'})
useTitle(t('sharing.authenticating'))
@ -80,13 +81,10 @@ function useAuth() {
: true
store.commit(LOGO_VISIBLE, logoVisible)
let view = 'list'
if (route.query.view &&
(route.query.view === 'gantt' ||
route.query.view === 'kanban' ||
route.query.view === 'table')) {
view = route.query.view
}
const view = route.query.view && Object.values(LIST_VIEWS).includes(route.query.view as ListView)
? route.query.view
: 'list'
router.push({name: `list.${view}`, params: {listId}})
} catch (e: any) {
if (e.response?.data?.code === 13001) {