Skip to content

Commit

Permalink
style(store/task)
Browse files Browse the repository at this point in the history
fix(store/workspace)
chore: remove TODO
  • Loading branch information
ChrisGray0626 committed Jul 24, 2024
1 parent df476dc commit 7300b3b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
15 changes: 7 additions & 8 deletions src/store/task.ts
Original file line number Diff line number Diff line change
@@ -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<Task>();

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<Tool>;
_task.value.tool = res.data;
console.log(_task.value);
}

Expand Down
4 changes: 2 additions & 2 deletions src/store/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import {fetchWorkspace} from "@/api";
import {computed, ref} from "vue";

export const useWorkspaceStore = defineStore("workspace", () => {
let root = ref<FileNode>({});
let root = ref<FileNode>();

async function updateData() {
const res = (await fetchWorkspace()).data as Response<FileNode>;
root.value = res.data;
}

const treeData = computed(() => root.value.children);
const treeData = computed(() => root.value!.children);

return {treeData, updateData};
});

0 comments on commit 7300b3b

Please sign in to comment.