Add application selection (#186)
Co-authored-by: AceDataCloud <office@acedata.cloud>
This commit is contained in:
1 parent
7af0e714cd
commit
d357d1c857
24 files changed
+266
-48
No files matched your search
@@ -2,15 +2,7 @@ import { applicationOperator, midjourneyOperator, serviceOperator } from '@/oper
|
||||
import { IMidjourneyState } from './models';
|
||||
import { ActionContext } from 'vuex';
|
||||
import { IRootState } from '../common/models';
|
||||
import {
|
||||
IApplication,
|
||||
IApplicationType,
|
||||
ICredential,
|
||||
IMidjourneyConfig,
|
||||
IMidjourneyTask,
|
||||
IMidjourneyTasksResponse,
|
||||
IService
|
||||
} from '@/models';
|
||||
import { IApplication, IApplicationType, ICredential, IMidjourneyConfig, IMidjourneyTask, IService } from '@/models';
|
||||
import { Status } from '@/models/common';
|
||||
import { MIDJOURNEY_SERVICE_ID } from '@/constants';
|
||||
import { mergeAndSortLists } from '@/utils/merge';
|
||||
@@ -45,8 +37,14 @@ export const setService = async ({ commit }: any, payload: IService): Promise<vo
|
||||
commit('setService', payload);
|
||||
};
|
||||
|
||||
export const setApplication = ({ commit }: any, payload: IApplication[]) => {
|
||||
export const setApplication = ({ commit }: any, payload: IApplication) => {
|
||||
commit('setApplication', payload);
|
||||
const credential = payload?.credentials?.find((credential) => credential?.host === window.location.origin);
|
||||
commit('setCredential', credential);
|
||||
};
|
||||
|
||||
export const setApplications = ({ commit }: any, payload: IApplication[]) => {
|
||||
commit('setApplications', payload);
|
||||
};
|
||||
|
||||
export const getApplications = async ({
|
||||
@@ -65,6 +63,7 @@ export const getApplications = async ({
|
||||
.then((response) => {
|
||||
console.debug('get applications success', response?.data);
|
||||
state.status.getApplications = Status.Success;
|
||||
commit('setApplications', response.data.items);
|
||||
// check if there is any application with 'Period' type
|
||||
const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD);
|
||||
const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE);
|
||||
@@ -175,6 +174,7 @@ export default {
|
||||
setConfig,
|
||||
setMode,
|
||||
setApplication,
|
||||
setApplications,
|
||||
getApplications,
|
||||
setTasks,
|
||||
getTasks
|
||||
|
||||
Reference in new issue
Block a user