upipe/frontend/src/services/taskService.ts
2025-03-31 17:53:41 +08:00

56 lines
1.3 KiB
TypeScript

import { create } from 'zustand';
import { Task } from '../interfaces/task';
// 定义任务类型
// 定义状态和操作
interface TaskState {
tasks: Task[];
getList: () => void;
}
// 创建 zustand store
const useTaskStore = create<TaskState>(() => ({
tasks: [
{
id: 1,
title: '任务1',
description: '这是任务1的描述',
created_at: Date.now(),
status: 'pending'
},
{
id: 2,
title: '任务2',
description: '这是任务2的描述',
created_at: Date.now(),
status: 'running'
},
{
id: 3,
title: '任务3',
description: '这是任务3的描述',
created_at: Date.now(),
status: 'completed'
},
{
id: 4,
title: '任务4',
description: '这是任务4的描述',
created_at: Date.now(),
status: 'failed'
},
{
id: 5,
title: '任务5',
description: '这是任务5的描述',
created_at: Date.now(),
status: 'blocked'
}
],
getList: () => {
}
}));
export default useTaskStore;