chore(web): 删 api/schema.ts overlay 死代码(B2)
fetchSchemaLayer/putOverlay/restoreStandard 全仓(含 e2e)零引用,真实 overlay API 在 editor/overlayApi.ts;删重复死份。tsc 干净 + vitest 77/77。见总览 §10 B2。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -61,42 +61,3 @@ export async function fetchSchema(templateId: string): Promise<Record<string, un
|
|||||||
);
|
);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
// F4-L1 overlay API(Node 侧 http 调用,供设计器 e2e 断言 X-Schema-Layer 用)
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
/** 获取 schema 并返回 layer 信息(overlay / standard) */
|
|
||||||
export async function fetchSchemaLayer(
|
|
||||||
templateId: string,
|
|
||||||
): Promise<{ schema: Record<string, unknown>; layer: string }> {
|
|
||||||
const resp = await http.get<Record<string, unknown>>(
|
|
||||||
`/api/page/schema/${encodeURIComponent(templateId)}`,
|
|
||||||
{ headers: { 'Cache-Control': 'no-cache' } },
|
|
||||||
);
|
|
||||||
const layer = (resp.headers['x-schema-layer'] ?? 'standard') as string;
|
|
||||||
return { schema: resp.data, layer };
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 保存 overlay(仅管理员) */
|
|
||||||
export async function putOverlay(
|
|
||||||
templateId: string,
|
|
||||||
schemaJson: string,
|
|
||||||
): Promise<{ status: number; msg: string }> {
|
|
||||||
const resp = await http.put(
|
|
||||||
`/api/page/schema/${encodeURIComponent(templateId)}/overlay`,
|
|
||||||
schemaJson,
|
|
||||||
{ headers: { 'Content-Type': 'application/json' } },
|
|
||||||
);
|
|
||||||
return resp.data as { status: number; msg: string };
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 还原标准版(删除 overlay,仅管理员) */
|
|
||||||
export async function restoreStandard(
|
|
||||||
templateId: string,
|
|
||||||
): Promise<{ status: number; msg: string }> {
|
|
||||||
const resp = await http.delete(
|
|
||||||
`/api/page/schema/${encodeURIComponent(templateId)}/overlay`,
|
|
||||||
);
|
|
||||||
return resp.data as { status: number; msg: string };
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user