Update application structure (#224)
Co-authored-by: AceDataCloud <office@acedata.cloud>
This commit is contained in:
1 parent
d49b7e6f6c
commit
9ae4229256
135 files changed
+2849
-2324
No files matched your search
@@ -13,6 +13,7 @@ export const resetAll = ({ commit }: ActionContext<IChatState, IRootState>): voi
|
||||
export const setApplication = async ({ commit, dispatch }: any, payload: IApplication): Promise<void> => {
|
||||
console.debug('set application', payload);
|
||||
commit('setApplication', payload);
|
||||
console.debug('application is set');
|
||||
if (!payload) {
|
||||
console.debug('application is null, return');
|
||||
return;
|
||||
@@ -91,12 +92,15 @@ export const getApplications = async ({
|
||||
user_id: rootState?.user?.id,
|
||||
service_id: CHAT_SERVICE_ID
|
||||
});
|
||||
console.debug('get applications success', applications);
|
||||
state.status.getApplications = Status.Success;
|
||||
commit('setApplications', applications.items);
|
||||
console.debug('set applications', applications.items);
|
||||
const finalApplication = getFinalApplication(applications.items, currentApplication);
|
||||
console.debug('final application', finalApplication);
|
||||
if (finalApplication) {
|
||||
console.debug('set final application', finalApplication, finalApplication?.type);
|
||||
await dispatch('setApplication', finalApplication);
|
||||
commit('setApplication', finalApplication);
|
||||
} else {
|
||||
console.debug('set application undefined', undefined);
|
||||
commit('setApplication', undefined);
|
||||
|
||||
@@ -145,10 +145,12 @@ export const login = async ({ state, commit }: ActionContext<IRootState, IRootSt
|
||||
flow: 'popup',
|
||||
visible: true
|
||||
});
|
||||
console.debug('login popup');
|
||||
} else {
|
||||
commit('setAuth', {
|
||||
flow: 'redirect'
|
||||
});
|
||||
console.debug('login redirect');
|
||||
loginRedirect({ redirect: window.location.pathname, site });
|
||||
}
|
||||
};
|
||||
@@ -158,7 +160,14 @@ export const logout = async ({ dispatch }: ActionContext<IRootState, IRootState>
|
||||
await dispatch('chat/resetAll');
|
||||
await dispatch('midjourney/resetAll');
|
||||
await dispatch('chatdoc/resetAll');
|
||||
await dispatch('flux/resetAll');
|
||||
await dispatch('hailuo/resetAll');
|
||||
await dispatch('headshots/resetAll');
|
||||
await dispatch('kling/resetAll');
|
||||
await dispatch('luma/resetAll');
|
||||
await dispatch('pika/resetAll');
|
||||
await dispatch('qrart/resetAll');
|
||||
await dispatch('suno/resetAll');
|
||||
await dispatch('login');
|
||||
};
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ export interface ICommonState {
|
||||
| undefined;
|
||||
}
|
||||
|
||||
export interface IRootState extends ICommonState {
|
||||
export interface IAppState {
|
||||
midjourney: IMidjourneyState;
|
||||
chat: IChatState;
|
||||
chatdoc: IChatdocState;
|
||||
@@ -44,3 +44,5 @@ export interface IRootState extends ICommonState {
|
||||
headshots: IHeadshotsState;
|
||||
suno: ISunoState;
|
||||
}
|
||||
|
||||
export interface IRootState extends ICommonState, IAppState {}
|
||||
Reference in new issue
Block a user