Skip to content

Commit

Permalink
fix(store/workspace)
Browse files Browse the repository at this point in the history
style(store/task)
refactor(store/job)
  • Loading branch information
ChrisGray0626 committed Jul 24, 2024
1 parent 7300b3b commit d9ac5b9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/api/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @Author: Chris
* @Date: 2024/7/1
*/
import { AxiosInstanceConfig, createAxiosInstance } from "@/api/axios.ts";
import {AxiosInstanceConfig, createAxiosInstance} from "@/api/axios.ts";

const BASE_URL = "http://47.237.25.20:32580/";

Expand Down Expand Up @@ -44,6 +44,6 @@ export function fetchLevelJob(data: string) {
*/
export function fetchTool(toolId: string) {
return axiosInstance.get(
"gis_agent_backend/test_tool/get_tool/?tool_id=" + toolId,
"/gis_agent_backend/test_tool/get_tool/?tool_id=" + toolId,
);
}
10 changes: 5 additions & 5 deletions src/store/job.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {defineStore} from "pinia";
import {job2G6TreeGraph, jobLeafNode2G6Graph} from "@/utils/graphUtil.ts";
import {computed} from "vue";
import {computed, ref} from "vue";
import {fetchSimpleJob} from "@/api";
import {Response, Task} from "@/type.ts";

export const useJobStore = defineStore("job", () => {
let _job: Task;
let _job = ref<Task>();

async function updateData(question: string) {
const res = (await fetchSimpleJob(`{ "task": "${question}" }`)).data as Response<any>;
// const res = (await fetchLevelJob(`{ "task": "${question}" }`)).data as Response<any>;
console.debug("res", res);
_job = convertData(res.data);
_job.value = convertData(res.data);

function convertData(data: any) {
const children = data.subtasks;
Expand All @@ -26,9 +26,9 @@ export const useJobStore = defineStore("job", () => {
}
}

const breakdownData = computed(() => job2G6TreeGraph(_job));
const breakdownData = computed(() => job2G6TreeGraph(_job.value));

Check failure on line 29 in src/store/job.ts

View workflow job for this annotation

GitHub Actions / build (18.x, chrisgray0626/gis-agent-frontend, 0.2)

Argument of type 'Task | undefined' is not assignable to parameter of type 'Task'.

const workflowData = computed(() => jobLeafNode2G6Graph(_job));
const workflowData = computed(() => jobLeafNode2G6Graph(_job.value));

Check failure on line 31 in src/store/job.ts

View workflow job for this annotation

GitHub Actions / build (18.x, chrisgray0626/gis-agent-frontend, 0.2)

Argument of type 'Task | undefined' is not assignable to parameter of type 'Task'.

return { updateData, breakdownData, workflowData };
});
2 changes: 1 addition & 1 deletion src/store/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const useWorkspaceStore = defineStore("workspace", () => {
root.value = res.data;
}

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

return {treeData, updateData};
});

0 comments on commit d9ac5b9

Please sign in to comment.