feat: port auth store to pinia

This commit is contained in:
Dominik Pschenitschni 2022-09-21 03:37:39 +02:00
parent f30c964c06
commit 7b53e684aa
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
34 changed files with 241 additions and 189 deletions

View file

@ -13,7 +13,6 @@ import {
MENU_ACTIVE,
QUICK_ACTIONS_ACTIVE,
} from './mutation-types'
import auth from './modules/auth'
import kanban from './modules/kanban'
import tasks from './modules/tasks'
@ -23,6 +22,7 @@ import ListService from '../services/list'
import {checkAndSetApiUrl} from '@/helpers/checkAndSetApiUrl'
import type { RootStoreState, StoreState } from './types'
import {useAuthStore} from '@/stores/auth'
export const key: InjectionKey<Store<StoreState>> = Symbol()
@ -34,7 +34,6 @@ export function useStore () {
export const store = createStore<RootStoreState>({
strict: import.meta.env.DEV,
modules: {
auth,
kanban,
tasks,
},
@ -131,9 +130,10 @@ export const store = createStore<RootStoreState>({
commit(CURRENT_LIST, list)
},
async loadApp({dispatch}) {
async loadApp() {
await checkAndSetApiUrl(window.API_URL)
await dispatch('auth/checkAuth')
const authStore = useAuthStore()
await authStore.checkAuth()
},
},
})