refactor(*): 代码质量治理 - 收敛接口客户端、模型职责与异步计费巡检
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
import axios from "axios";
|
||||
|
||||
import type { BackendEnvelope } from "@/services/api/task-center";
|
||||
import type { CanvasProject } from "@/stores/canvas/use-canvas-store";
|
||||
import { apiClient, request } from "@/services/api/request";
|
||||
|
||||
const api = axios.create({ baseURL: import.meta.env.VITE_CANVAS_BACKEND_URL || "/api", withCredentials: true });
|
||||
const api = apiClient;
|
||||
|
||||
export type CanvasShareStatus = {
|
||||
enabled: boolean;
|
||||
@@ -17,12 +15,6 @@ export type PublicCanvasShare = {
|
||||
expiresAt?: string;
|
||||
};
|
||||
|
||||
async function request<T>(promise: Promise<{ data: BackendEnvelope<T> }>) {
|
||||
const response = await promise;
|
||||
if (response.data.code !== 0) throw new Error(response.data.msg || "请求失败");
|
||||
return response.data.data;
|
||||
}
|
||||
|
||||
export function getCanvasShare(projectId: string) {
|
||||
return request<{ share: CanvasShareStatus }>(api.get(`/canvas-projects/${encodeURIComponent(projectId)}/share`));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user