diff --git a/src/api/index.ts b/src/api/index.ts index e7b6ed0..c717578 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -7,6 +7,4 @@ // 手动修改 Mock 接口 export * from "./job.ts"; // export * from "./mock.ts"; -export * from "./qgis.ts"; - -// TODO: interface definition of api +export * from "./qgis.ts"; \ No newline at end of file diff --git a/src/store/task.ts b/src/store/task.ts index ca93ada..125969c 100644 --- a/src/store/task.ts +++ b/src/store/task.ts @@ -1,20 +1,19 @@ -import { defineStore } from "pinia"; -import { computed, ref } from "vue"; -import { Task } from "@/type.ts"; -import { fetchTool } from "@/api"; +import {defineStore} from "pinia"; +import {computed, ref} from "vue"; +import {Response, Task, Tool} from "@/type.ts"; +import {fetchTool} from "@/api"; export const useTaskStore = defineStore("node", () => { let _task = ref(); - const tool = computed(() => _task.value?.tool); + const tool = computed(() => _task.value!.tool); let isShowed = ref(false); async function updateData(task: Task) { _task.value = task; - // TODO Fetch the tool - // const res = await fetchTool(node.tool.id).data; - _task.value.tool = (await fetchTool(_task.value.tool.id)).data.data; + const res = (await fetchTool(_task.value.tool.id)).data as Response; + _task.value.tool = res.data; console.log(_task.value); } diff --git a/src/store/workspace.ts b/src/store/workspace.ts index 9e666b9..c047da2 100644 --- a/src/store/workspace.ts +++ b/src/store/workspace.ts @@ -9,14 +9,14 @@ import {fetchWorkspace} from "@/api"; import {computed, ref} from "vue"; export const useWorkspaceStore = defineStore("workspace", () => { - let root = ref({}); + let root = ref(); async function updateData() { const res = (await fetchWorkspace()).data as Response; root.value = res.data; } - const treeData = computed(() => root.value.children); + const treeData = computed(() => root.value!.children); return {treeData, updateData}; });