From 57a7831edfe40711286da918cd815c1e8c87a89f Mon Sep 17 00:00:00 2001 From: martsi Date: Tue, 23 Jul 2024 20:05:28 +0800 Subject: [PATCH] fix(async) --- src/api/qgis.ts | 4 ++-- src/store/workspace.ts | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/api/qgis.ts b/src/api/qgis.ts index 2b7cf8b..6800cfe 100644 --- a/src/api/qgis.ts +++ b/src/api/qgis.ts @@ -3,7 +3,7 @@ * @Author: Chris * @Date: 2024/7/2 */ -import {AxiosInstanceConfig, createAxiosInstance} from "@/api/axios.ts"; +import { AxiosInstanceConfig, createAxiosInstance } from "@/api/axios.ts"; const BASE_URL = "http://47.96.77.183:8000/"; @@ -16,7 +16,7 @@ const axiosInstance = createAxiosInstance(axiosConfig); /** * 获取工作空间 */ -export async function fetchWorkspace() { +export function fetchWorkspace() { return axiosInstance.get("/qgis/process/list_qgis_temp_dir_with_structure/"); } diff --git a/src/store/workspace.ts b/src/store/workspace.ts index fbce85e..88b114a 100644 --- a/src/store/workspace.ts +++ b/src/store/workspace.ts @@ -3,15 +3,15 @@ * @Author: Chris * @Date: 2024/7/23 */ -import {defineStore} from "pinia"; -import {FileNode, Response} from "@/type.ts"; -import {fetchWorkspace} from "@/api"; -import {ref} from "vue"; +import { defineStore } from "pinia"; +import { FileNode, Response } from "@/type.ts"; +import { fetchWorkspace } from "@/api"; +import { ref } from "vue"; export const useWorkspaceStore = defineStore("workspace", () => { let _fileTree = ref(); - function updateData() { + async function updateData() { const res = (await fetchWorkspace()).data as Response; _fileTree.value = convertData(res.data); } @@ -27,5 +27,5 @@ export const useWorkspaceStore = defineStore("workspace", () => { return fileNode; } - return {updateData}; -}); \ No newline at end of file + return { updateData }; +});