From 7b53e684aa405a7874f189dcb404c031dfed1388 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Wed, 21 Sep 2022 03:37:39 +0200 Subject: [PATCH] feat: port auth store to pinia --- src/App.vue | 8 +- src/components/date/datepickerWithRange.vue | 6 +- src/components/home/TheNavigation.vue | 12 +- src/components/home/contentAuth.vue | 13 +- src/components/input/datepicker.vue | 7 +- .../notifications/notifications.vue | 8 +- src/components/sharing/userTeam.vue | 8 +- src/components/tasks/add-task.vue | 4 +- src/components/tasks/partials/comments.vue | 8 +- src/components/tasks/partials/defer-task.vue | 12 +- src/router/index.ts | 8 +- src/store/index.ts | 8 +- src/store/types.ts | 1 + src/stores/auth.ts | 168 ++++++++++-------- src/views/Home.vue | 10 +- src/views/labels/ListLabels.vue | 10 +- src/views/list/ListGantt.vue | 8 +- src/views/list/settings/share.vue | 4 +- src/views/namespaces/settings/share.vue | 11 +- src/views/sharing/LinkSharingAuth.vue | 6 +- src/views/tasks/ShowTasks.vue | 4 +- src/views/teams/EditTeam.vue | 11 +- src/views/user/DataExportDownload.vue | 5 +- src/views/user/Login.vue | 13 +- src/views/user/OpenIdAuth.vue | 4 +- src/views/user/Register.vue | 7 +- src/views/user/Settings.vue | 6 +- src/views/user/settings/Avatar.vue | 12 +- src/views/user/settings/Caldav.vue | 8 +- src/views/user/settings/DataExport.vue | 8 +- src/views/user/settings/Deletion.vue | 8 +- src/views/user/settings/EmailUpdate.vue | 6 +- src/views/user/settings/General.vue | 10 +- src/views/user/settings/PasswordUpdate.vue | 8 +- 34 files changed, 241 insertions(+), 189 deletions(-) diff --git a/src/App.vue b/src/App.vue index c63cf7bf..81fcf611 100644 --- a/src/App.vue +++ b/src/App.vue @@ -36,15 +36,17 @@ import AccountDeleteService from '@/services/accountDelete' import {useColorScheme} from '@/composables/useColorScheme' import {useBodyClass} from '@/composables/useBodyClass' +import {useAuthStore} from './stores/auth' const store = useStore() +const authStore = useAuthStore() const router = useRouter() useBodyClass('is-touch', isTouchDevice()) const keyboardShortcutsActive = computed(() => store.state.keyboardShortcutsActive) -const authUser = computed(() => store.getters['auth/authUser']) -const authLinkShare = computed(() => store.getters['auth/authLinkShare']) +const authUser = computed(() => authStore.authUser) +const authLinkShare = computed(() => authStore.authLinkShare) const {t} = useI18n({useScope: 'global'}) @@ -58,7 +60,7 @@ watch(accountDeletionConfirm, async (accountDeletionConfirm) => { const accountDeletionService = new AccountDeleteService() await accountDeletionService.confirm(accountDeletionConfirm) success({message: t('user.deletion.confirmSuccess')}) - store.dispatch('auth/refreshUserInfo') + authStore.refreshUserInfo() }, { immediate: true }) // setup password reset redirect diff --git a/src/components/date/datepickerWithRange.vue b/src/components/date/datepickerWithRange.vue index 23181279..8546c143 100644 --- a/src/components/date/datepickerWithRange.vue +++ b/src/components/date/datepickerWithRange.vue @@ -71,7 +71,6 @@ diff --git a/src/views/list/settings/share.vue b/src/views/list/settings/share.vue index 856155e6..c86536c9 100644 --- a/src/views/list/settings/share.vue +++ b/src/views/list/settings/share.vue @@ -41,6 +41,7 @@ import CreateEdit from '@/components/misc/create-edit.vue' import LinkSharing from '@/components/sharing/linkSharing.vue' import userTeam from '@/components/sharing/userTeam.vue' import {useConfigStore} from '@/stores/config' +import {useAuthStore} from '@/stores/auth' const {t} = useI18n({useScope: 'global'}) @@ -52,10 +53,11 @@ const title = computed(() => list.value?.title useTitle(title) const store = useStore() +const authStore = useAuthStore() const configStore = useConfigStore() const linkSharingEnabled = computed(() => configStore.linkSharingEnabled) -const userIsAdmin = computed(() => 'owner' in list.value && list.value.owner.id === store.state.auth.info.id) +const userIsAdmin = computed(() => 'owner' in list.value && list.value.owner.id === authStore.info.id) async function loadList(listId: number) { const listService = new ListService() diff --git a/src/views/namespaces/settings/share.vue b/src/views/namespaces/settings/share.vue index 25f212db..5bcc9e06 100644 --- a/src/views/namespaces/settings/share.vue +++ b/src/views/namespaces/settings/share.vue @@ -26,20 +26,21 @@ export default { name: 'namespace-setting-share' } diff --git a/src/views/user/settings/DataExport.vue b/src/views/user/settings/DataExport.vue index 29aeb852..7e0005d2 100644 --- a/src/views/user/settings/DataExport.vue +++ b/src/views/user/settings/DataExport.vue @@ -44,22 +44,22 @@ export default {name: 'user-settings-data-export'} diff --git a/src/views/user/settings/EmailUpdate.vue b/src/views/user/settings/EmailUpdate.vue index ef8a3e42..96e9e42d 100644 --- a/src/views/user/settings/EmailUpdate.vue +++ b/src/views/user/settings/EmailUpdate.vue @@ -43,18 +43,18 @@ export default { name: 'user-settings-update-email' }