mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-28 17:50:56 +01:00
47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
import {
|
|
getDefaultStoreActions,
|
|
getDefaultStoreGetters,
|
|
getDefaultStoreMutations,
|
|
getDefaultStoreState
|
|
} from '@/utils/store';
|
|
import useRequest from '@/services/request';
|
|
import {TAB_NAME_OVERVIEW, TAB_NAME_TASKS} from '@/constants/tab';
|
|
|
|
const {
|
|
post,
|
|
} = useRequest();
|
|
|
|
const state = {
|
|
...getDefaultStoreState<Schedule>('schedule'),
|
|
tabs: [
|
|
{id: TAB_NAME_OVERVIEW, title: 'Overview'},
|
|
{id: TAB_NAME_TASKS, title: 'Tasks'},
|
|
],
|
|
} as ScheduleStoreState;
|
|
|
|
const getters = {
|
|
...getDefaultStoreGetters<Schedule>(),
|
|
} as ScheduleStoreGetters;
|
|
|
|
const mutations = {
|
|
...getDefaultStoreMutations<Schedule>(),
|
|
} as ScheduleStoreMutations;
|
|
|
|
const actions = {
|
|
...getDefaultStoreActions<Schedule>('/schedules'),
|
|
enable: async (ctx: StoreActionContext, id: string) => {
|
|
return await post(`/schedules/${id}/enable`);
|
|
},
|
|
disable: async (ctx: StoreActionContext, id: string) => {
|
|
return await post(`/schedules/${id}/disable`);
|
|
},
|
|
} as ScheduleStoreActions;
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state,
|
|
getters,
|
|
mutations,
|
|
actions,
|
|
} as ScheduleStoreModule;
|