From a94a64f4a2121388ad3981b5802f5deb53d6405f Mon Sep 17 00:00:00 2001 From: Germey Date: Sat, 29 Nov 2025 20:19:57 +0800 Subject: [PATCH] Fix logout (#289) --- ...nexior-82b3f0e7-3169-48e8-af86-56e0dffa570e.json | 7 +++++++ src/constants/nanobanana.ts | 2 +- src/pages/nanobanana/Index.vue | 2 +- src/pages/profile/Index.vue | 13 +------------ src/store/chat/mutations.ts | 6 ++---- src/store/common/actions.ts | 2 ++ src/store/flux/mutations.ts | 7 ++----- src/store/hailuo/mutations.ts | 7 ++----- src/store/headshots/mutations.ts | 7 ++----- src/store/kling/mutations.ts | 7 ++----- src/store/luma/mutations.ts | 7 ++----- src/store/midjourney/mutations.ts | 9 ++------- src/store/nanobanana/mutations.ts | 7 ++----- src/store/pika/mutations.ts | 7 ++----- src/store/pixverse/mutations.ts | 7 ++----- src/store/qrart/mutations.ts | 7 ++----- src/store/sora/mutations.ts | 7 ++----- src/store/veo/mutations.ts | 7 ++----- 18 files changed, 38 insertions(+), 80 deletions(-) create mode 100644 change/@acedatacloud-nexior-82b3f0e7-3169-48e8-af86-56e0dffa570e.json diff --git a/change/@acedatacloud-nexior-82b3f0e7-3169-48e8-af86-56e0dffa570e.json b/change/@acedatacloud-nexior-82b3f0e7-3169-48e8-af86-56e0dffa570e.json new file mode 100644 index 00000000..418d4955 --- /dev/null +++ b/change/@acedatacloud-nexior-82b3f0e7-3169-48e8-af86-56e0dffa570e.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix logout", + "packageName": "@acedatacloud/nexior", + "email": "cqc@cuiqingcai.com", + "dependentChangeType": "patch" +} diff --git a/src/constants/nanobanana.ts b/src/constants/nanobanana.ts index a21e3779..056da39a 100644 --- a/src/constants/nanobanana.ts +++ b/src/constants/nanobanana.ts @@ -1,4 +1,4 @@ -export const NANOBANANA_SERVICE_ID = ''; +export const NANOBANANA_SERVICE_ID = '44fa6ed2-1ad1-4c7e-a8bd-30002728c0d1'; export const NANOBANANA_DEFAULT_ACTION: 'generate' | 'edit' = 'generate'; diff --git a/src/pages/nanobanana/Index.vue b/src/pages/nanobanana/Index.vue index 8bedd594..ab4b7ac3 100644 --- a/src/pages/nanobanana/Index.vue +++ b/src/pages/nanobanana/Index.vue @@ -119,7 +119,7 @@ export default defineComponent({ return; } console.debug('start onGetTasks', payload); - const { limit = 5, createdAtMin, createdAtMax } = payload || {}; + const { limit = 20, createdAtMin, createdAtMax } = payload || {}; console.debug('limit', limit, 'createdAtMin', createdAtMin, 'createdAtMax', createdAtMax); await this.$store.dispatch('nanobanana/getTasks', { limit, diff --git a/src/pages/profile/Index.vue b/src/pages/profile/Index.vue index 41a9870b..3f3cc2da 100644 --- a/src/pages/profile/Index.vue +++ b/src/pages/profile/Index.vue @@ -163,18 +163,7 @@ export default defineComponent({ text: this.$t('common.nav.logOut'), icon: 'fa-solid fa-arrow-right-from-bracket', callback: async () => { - await this.$store.dispatch('resetAll'); - await this.$store.dispatch('chat/resetAll'); - await this.$store.dispatch('midjourney/resetAll'); - await this.$store.dispatch('qrart/resetAll'); - await this.$store.dispatch('flux/resetAll'); - await this.$store.dispatch('hailuo/resetAll'); - await this.$store.dispatch('headshots/resetAll'); - await this.$store.dispatch('kling/resetAll'); - await this.$store.dispatch('luma/resetAll'); - await this.$store.dispatch('pika/resetAll'); - await this.$store.dispatch('suno/resetAll'); - await this.$store.dispatch('login'); + await this.$store.dispatch('logout'); } } ]; diff --git a/src/store/chat/mutations.ts b/src/store/chat/mutations.ts index 8c9bf161..ae5044e4 100644 --- a/src/store/chat/mutations.ts +++ b/src/store/chat/mutations.ts @@ -1,11 +1,9 @@ import { IApplication, IChatConversation, IChatModel, IChatModelGroup, ICredential, IService } from '@/models'; +import initialState from './state'; import { IChatState } from './models'; export const resetAll = (state: IChatState): void => { - state.application = undefined; - state.conversations = undefined; - state.credential = undefined; - state.service = undefined; + Object.assign(state, initialState()); }; export const setModel = (state: IChatState, payload: IChatModel): void => { diff --git a/src/store/common/actions.ts b/src/store/common/actions.ts index c66cc68b..d6b8b19f 100644 --- a/src/store/common/actions.ts +++ b/src/store/common/actions.ts @@ -224,7 +224,9 @@ export const logout = async ({ dispatch }: ActionContext await dispatch('pika/resetAll'); await dispatch('pixverse/resetAll'); await dispatch('qrart/resetAll'); + await dispatch('sora/resetAll'); await dispatch('suno/resetAll'); + await dispatch('nanobanana/resetAll'); await dispatch('veo/resetAll'); const currentUrl = window.location.href; const baseUrlAuth = getBaseUrlAuth(); diff --git a/src/store/flux/mutations.ts b/src/store/flux/mutations.ts index e5e951c3..59f03f5e 100644 --- a/src/store/flux/mutations.ts +++ b/src/store/flux/mutations.ts @@ -1,12 +1,9 @@ import { IApplication, ICredential, IFluxConfig, IFluxTask, IService } from '@/models'; +import initialState from './state'; import { IFluxState } from './models'; export const resetAll = (state: IFluxState): void => { - state.service = undefined; - state.application = undefined; - state.config = undefined; - state.credential = undefined; - state.tasks = undefined; + Object.assign(state, initialState()); }; export const setService = (state: IFluxState, payload: IService): void => { diff --git a/src/store/hailuo/mutations.ts b/src/store/hailuo/mutations.ts index 233dd5c0..d67f86b8 100644 --- a/src/store/hailuo/mutations.ts +++ b/src/store/hailuo/mutations.ts @@ -1,12 +1,9 @@ import { IApplication, ICredential, IHailuoConfig, IHailuoTask, IService } from '@/models'; +import initialState from './state'; import { IHailuoState } from './models'; export const resetAll = (state: IHailuoState): void => { - state.service = undefined; - state.application = undefined; - state.config = undefined; - state.credential = undefined; - state.tasks = undefined; + Object.assign(state, initialState()); }; export const setService = (state: IHailuoState, payload: IService): void => { diff --git a/src/store/headshots/mutations.ts b/src/store/headshots/mutations.ts index 4b631cbb..12d41cc5 100644 --- a/src/store/headshots/mutations.ts +++ b/src/store/headshots/mutations.ts @@ -1,12 +1,9 @@ import { IApplication, ICredential, IHeadshotsConfig, IHeadshotsTask, IService } from '@/models'; +import initialState from './state'; import { IHeadshotsState } from './models'; export const resetAll = (state: IHeadshotsState): void => { - state.service = undefined; - state.application = undefined; - state.config = undefined; - state.credential = undefined; - state.tasks = undefined; + Object.assign(state, initialState()); }; export const setService = (state: IHeadshotsState, payload: IService): void => { diff --git a/src/store/kling/mutations.ts b/src/store/kling/mutations.ts index dc2b533b..06ff3740 100644 --- a/src/store/kling/mutations.ts +++ b/src/store/kling/mutations.ts @@ -1,12 +1,9 @@ import { IApplication, ICredential, IKlingConfig, IKlingTask, IService } from '@/models'; +import initialState from './state'; import { IKlingState } from './models'; export const resetAll = (state: IKlingState): void => { - state.service = undefined; - state.application = undefined; - state.config = undefined; - state.credential = undefined; - state.tasks = undefined; + Object.assign(state, initialState()); }; export const setService = (state: IKlingState, payload: IService): void => { diff --git a/src/store/luma/mutations.ts b/src/store/luma/mutations.ts index de64be47..96d994e4 100644 --- a/src/store/luma/mutations.ts +++ b/src/store/luma/mutations.ts @@ -1,12 +1,9 @@ import { IApplication, ICredential, ILumaConfig, ILumaTask, IService } from '@/models'; +import initialState from './state'; import { ILumaState } from './models'; export const resetAll = (state: ILumaState): void => { - state.service = undefined; - state.application = undefined; - state.config = undefined; - state.credential = undefined; - state.tasks = undefined; + Object.assign(state, initialState()); }; export const setService = (state: ILumaState, payload: IService): void => { diff --git a/src/store/midjourney/mutations.ts b/src/store/midjourney/mutations.ts index 77ba3890..9bf493a1 100644 --- a/src/store/midjourney/mutations.ts +++ b/src/store/midjourney/mutations.ts @@ -1,14 +1,9 @@ import { IApplication, ICredential, IMidjourneyConfig, IService, IMidjourneyTask } from '@/models'; +import initialState from './state'; import { IMidjourneyState } from './models'; export const resetAll = (state: IMidjourneyState): void => { - state.application = undefined; - state.applications = undefined; - state.config = {}; - state.tasks = { - items: undefined, - total: undefined - }; + Object.assign(state, initialState()); }; export const setTasksItems = (state: IMidjourneyState, payload: IMidjourneyTask[]): void => { diff --git a/src/store/nanobanana/mutations.ts b/src/store/nanobanana/mutations.ts index 7827ca94..60c40f11 100644 --- a/src/store/nanobanana/mutations.ts +++ b/src/store/nanobanana/mutations.ts @@ -1,12 +1,9 @@ import { IApplication, ICredential, INanobananaConfig, INanobananaTask, IService } from '@/models'; +import initialState from './state'; import { INanobananaState } from './models'; export const resetAll = (state: INanobananaState): void => { - state.service = undefined; - state.application = undefined; - state.config = undefined; - state.credential = undefined; - state.tasks = undefined; + Object.assign(state, initialState()); }; export const setService = (state: INanobananaState, payload: IService): void => { diff --git a/src/store/pika/mutations.ts b/src/store/pika/mutations.ts index e99c4f95..044030c8 100644 --- a/src/store/pika/mutations.ts +++ b/src/store/pika/mutations.ts @@ -1,12 +1,9 @@ import { IApplication, ICredential, IPikaConfig, IPikaTask, IService } from '@/models'; +import initialState from './state'; import { IPikaState } from './models'; export const resetAll = (state: IPikaState): void => { - state.service = undefined; - state.application = undefined; - state.config = undefined; - state.credential = undefined; - state.tasks = undefined; + Object.assign(state, initialState()); }; export const setService = (state: IPikaState, payload: IService): void => { diff --git a/src/store/pixverse/mutations.ts b/src/store/pixverse/mutations.ts index 0f902441..2db34f3c 100644 --- a/src/store/pixverse/mutations.ts +++ b/src/store/pixverse/mutations.ts @@ -1,12 +1,9 @@ import { IApplication, ICredential, IPixverseConfig, IPixverseTask, IService } from '@/models'; +import initialState from './state'; import { IPixverseState } from './models'; export const resetAll = (state: IPixverseState): void => { - state.service = undefined; - state.application = undefined; - state.config = undefined; - state.credential = undefined; - state.tasks = undefined; + Object.assign(state, initialState()); }; export const setService = (state: IPixverseState, payload: IService): void => { diff --git a/src/store/qrart/mutations.ts b/src/store/qrart/mutations.ts index 2ac5bf4d..a918df85 100644 --- a/src/store/qrart/mutations.ts +++ b/src/store/qrart/mutations.ts @@ -1,12 +1,9 @@ import { IApplication, ICredential, IQrartConfig, IQrartTask, IService } from '@/models'; +import initialState from './state'; import { IQrartState } from './models'; export const resetAll = (state: IQrartState): void => { - state.service = undefined; - state.application = undefined; - state.config = undefined; - state.credential = undefined; - state.tasks = undefined; + Object.assign(state, initialState()); }; export const setService = (state: IQrartState, payload: IService): void => { diff --git a/src/store/sora/mutations.ts b/src/store/sora/mutations.ts index f8f3d935..9decb83c 100644 --- a/src/store/sora/mutations.ts +++ b/src/store/sora/mutations.ts @@ -1,12 +1,9 @@ import { IApplication, ICredential, ISoraConfig, ISoraTask, IService } from '@/models'; +import initialState from './state'; import { ISoraState } from './models'; export const resetAll = (state: ISoraState): void => { - state.service = undefined; - state.application = undefined; - state.config = undefined; - state.credential = undefined; - state.tasks = undefined; + Object.assign(state, initialState()); }; export const setService = (state: ISoraState, payload: IService): void => { diff --git a/src/store/veo/mutations.ts b/src/store/veo/mutations.ts index 06517c99..0f01cff8 100644 --- a/src/store/veo/mutations.ts +++ b/src/store/veo/mutations.ts @@ -1,12 +1,9 @@ import { IApplication, ICredential, IVeoConfig, IVeoTask, IService } from '@/models'; +import initialState from './state'; import { IVeoState } from './models'; export const resetAll = (state: IVeoState): void => { - state.service = undefined; - state.application = undefined; - state.config = undefined; - state.credential = undefined; - state.tasks = undefined; + Object.assign(state, initialState()); }; export const setService = (state: IVeoState, payload: IService): void => {