refactor(portal): move stores and rename portal auth store
- apps/portal/src/stores/useAuthStore.ts →
apps/app/src/stores/portal/usePortalAuthStore.ts. The export and
defineStore id are renamed (useAuthStore → usePortalAuthStore,
'auth' → 'portalAuth') so it can coexist with the organizer's
apps/app/src/stores/useAuthStore. Lazy import inside
resetPortalStoresSync() updated to the new path.
- apps/portal/src/stores/usePortalStore.ts →
apps/app/src/stores/portal/usePortalStore.ts (no name change —
apps/app does not have a usePortalStore).
All call sites in moved pages/components now import from
@/stores/portal/{usePortalStore,usePortalAuthStore} and call
usePortalAuthStore() instead of useAuthStore().
PR-B2 will merge this back into a single context-aware auth store.
Also includes the C.1 page meta-block updates (layout: 'PortalLayout'
| 'PublicLayout', context: 'portal') that were left unstaged after
the page-rename commit picked up only the path change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { useAuthStore } from '@/stores/useAuthStore'
|
||||
import { usePortalAuthStore } from '@/stores/portal/usePortalAuthStore'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const authStore = usePortalAuthStore()
|
||||
const router = useRouter()
|
||||
|
||||
const userInitials = computed(() => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { usePortalStore } from '@/stores/usePortalStore'
|
||||
import { usePortalStore } from '@/stores/portal/usePortalStore'
|
||||
|
||||
defineProps<{
|
||||
eventId: string
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import StatusCard from '@/components/portal/StatusCard.vue'
|
||||
import { usePortalStore } from '@/stores/usePortalStore'
|
||||
import { usePortalStore } from '@/stores/portal/usePortalStore'
|
||||
import { useMyShifts } from '@/composables/api/usePortalShifts'
|
||||
import type { PortalPersonPayload } from '@/types/portal'
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
definePage({
|
||||
name: 'artist-advance',
|
||||
meta: {
|
||||
layout: 'portal',
|
||||
layout: 'PortalLayout',
|
||||
requiresAuth: false,
|
||||
requiresToken: true,
|
||||
context: 'portal',
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import OverzichtTab from '@/components/event/OverzichtTab.vue'
|
||||
import RoosterTab from '@/components/event/RoosterTab.vue'
|
||||
import ClaimenTab from '@/components/event/ClaimenTab.vue'
|
||||
import InformatieTab from '@/components/event/InformatieTab.vue'
|
||||
import { usePortalStore } from '@/stores/usePortalStore'
|
||||
import OverzichtTab from '@/components/portal/event/OverzichtTab.vue'
|
||||
import RoosterTab from '@/components/portal/event/RoosterTab.vue'
|
||||
import ClaimenTab from '@/components/portal/event/ClaimenTab.vue'
|
||||
import InformatieTab from '@/components/portal/event/InformatieTab.vue'
|
||||
import { usePortalStore } from '@/stores/portal/usePortalStore'
|
||||
|
||||
definePage({
|
||||
name: 'portal-event-detail',
|
||||
meta: {
|
||||
layout: 'portal',
|
||||
layout: 'PortalLayout',
|
||||
requiresAuth: true,
|
||||
context: 'portal',
|
||||
navMode: 'event',
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import EventCard from '@/components/portal/EventCard.vue'
|
||||
import { usePortalStore } from '@/stores/usePortalStore'
|
||||
import { usePortalStore } from '@/stores/portal/usePortalStore'
|
||||
|
||||
definePage({
|
||||
name: 'portal-evenementen',
|
||||
meta: {
|
||||
layout: 'portal',
|
||||
layout: 'PortalLayout',
|
||||
requiresAuth: true,
|
||||
context: 'portal',
|
||||
navMode: 'platform',
|
||||
navTitle: 'Mijn evenementen',
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { useAuthStore } from '@/stores/useAuthStore'
|
||||
import { usePortalStore } from '@/stores/usePortalStore'
|
||||
import { usePortalAuthStore } from '@/stores/portal/usePortalAuthStore'
|
||||
import { usePortalStore } from '@/stores/portal/usePortalStore'
|
||||
import { useUpdateProfile, useUpdatePassword } from '@/composables/api/usePortalProfile'
|
||||
import {
|
||||
useMfaStatus,
|
||||
@@ -19,14 +19,15 @@ import type { ApiErrorResponse } from '@/types/api'
|
||||
definePage({
|
||||
name: 'portal-profiel',
|
||||
meta: {
|
||||
layout: 'portal',
|
||||
layout: 'PortalLayout',
|
||||
requiresAuth: true,
|
||||
context: 'portal',
|
||||
navMode: 'platform',
|
||||
navTitle: 'Mijn profiel',
|
||||
},
|
||||
})
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const authStore = usePortalAuthStore()
|
||||
const portal = usePortalStore()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
definePage({
|
||||
name: 'volunteer-register-info',
|
||||
meta: {
|
||||
layout: 'blank',
|
||||
layout: 'PortalLayout',
|
||||
requiresAuth: false,
|
||||
context: 'portal',
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
import { useAllMyShifts } from '@/composables/api/usePortalShifts'
|
||||
import { useAuthStore } from '@/stores/useAuthStore'
|
||||
import { usePortalAuthStore } from '@/stores/portal/usePortalAuthStore'
|
||||
import type { AllMyShiftsAssignment } from '@/types/portal-shift'
|
||||
|
||||
definePage({
|
||||
name: 'portal-shifts',
|
||||
meta: {
|
||||
layout: 'portal',
|
||||
layout: 'PortalLayout',
|
||||
requiresAuth: true,
|
||||
context: 'portal',
|
||||
},
|
||||
})
|
||||
|
||||
const auth = useAuthStore()
|
||||
const auth = usePortalAuthStore()
|
||||
const { data: eventGroups, isLoading, isError, refetch } = useAllMyShifts()
|
||||
|
||||
const statusConfig: Record<string, { label: string; color: string }> = {
|
||||
|
||||
@@ -9,8 +9,9 @@ import { apiClient } from '@/lib/axios'
|
||||
definePage({
|
||||
name: 'set-password',
|
||||
meta: {
|
||||
layout: 'blank',
|
||||
layout: 'PortalLayout',
|
||||
requiresAuth: false,
|
||||
context: 'portal',
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
<script setup lang="ts">
|
||||
import { emailValidator } from '@core/utils/validators'
|
||||
import FieldRenderer from '@/components/public-form/FieldRenderer.vue'
|
||||
import FormConfirmation from '@/components/public-form/FormConfirmation.vue'
|
||||
import FormErrorState from '@/components/public-form/FormErrorState.vue'
|
||||
import FormStepper from '@/components/public-form/FormStepper.vue'
|
||||
import SubmitterDetails from '@/components/public-form/SubmitterDetails.vue'
|
||||
import FieldRenderer from '@/components/shared/public-form/FieldRenderer.vue'
|
||||
import FormConfirmation from '@/components/shared/public-form/FormConfirmation.vue'
|
||||
import FormErrorState from '@/components/shared/public-form/FormErrorState.vue'
|
||||
import FormStepper from '@/components/shared/public-form/FormStepper.vue'
|
||||
import SubmitterDetails from '@/components/shared/public-form/SubmitterDetails.vue'
|
||||
import { extractErrorBody, useFetchPublicFormSchema } from '@/composables/api/usePublicForm'
|
||||
import { usePublicFormSections } from '@/composables/api/usePublicFormSections'
|
||||
import { usePublicFormTimeSlots } from '@/composables/api/usePublicFormTimeSlots'
|
||||
import { useFormDraft } from '@/composables/useFormDraft'
|
||||
import { isStepValid, useFormSteps } from '@form-schema/composables/useFormSteps'
|
||||
import { formatFieldValue } from '@form-schema/composables/formatFieldValue'
|
||||
import { isStepValid, useFormSteps } from '@/composables/forms/composables/useFormSteps'
|
||||
import { formatFieldValue } from '@/composables/forms/composables/formatFieldValue'
|
||||
import { providePublicFormLocale, providePublicFormToken } from '@/composables/publicFormInjection'
|
||||
import { FormFieldType } from '@form-schema/types/formBuilder'
|
||||
import type { FormErrorCode, PublicFormField } from '@form-schema/types/formBuilder'
|
||||
import { FormFieldType } from '@/composables/forms/types/formBuilder'
|
||||
import type { FormErrorCode, PublicFormField } from '@/composables/forms/types/formBuilder'
|
||||
|
||||
definePage({
|
||||
name: 'public-form-register',
|
||||
meta: {
|
||||
layout: 'blank',
|
||||
requiresAuth: false,
|
||||
layout: 'PublicLayout',
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import { useAuthStore } from '@/stores/useAuthStore'
|
||||
import { usePortalAuthStore } from '@/stores/portal/usePortalAuthStore'
|
||||
|
||||
definePage({
|
||||
name: 'register-success',
|
||||
meta: {
|
||||
layout: 'portal',
|
||||
requiresAuth: false,
|
||||
navMode: 'platform',
|
||||
layout: 'PublicLayout',
|
||||
},
|
||||
})
|
||||
|
||||
const route = useRoute('register-success')
|
||||
const authStore = useAuthStore()
|
||||
const authStore = usePortalAuthStore()
|
||||
|
||||
const eventName = computed(() => (route.query.event as string) || 'het evenement')
|
||||
const bannerUrl = computed(() => (route.query.banner as string) || null)
|
||||
|
||||
@@ -3,7 +3,7 @@ import { computed, ref } from 'vue'
|
||||
import { apiClient } from '@/lib/axios'
|
||||
import type { AuthMeUser } from '@/types/portal'
|
||||
|
||||
export const useAuthStore = defineStore('auth', () => {
|
||||
export const usePortalAuthStore = defineStore('portalAuth', () => {
|
||||
const user = ref<AuthMeUser | null>(null)
|
||||
const isInitialized = ref(false)
|
||||
|
||||
@@ -14,7 +14,7 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
}
|
||||
|
||||
async function resetPortalStoresSync(): Promise<void> {
|
||||
const { usePortalStore } = await import('@/stores/usePortalStore')
|
||||
const { usePortalStore } = await import('@/stores/portal/usePortalStore')
|
||||
usePortalStore().reset()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user