fix(859-8): B05 · B06 구조물 정의 주소 = /api/m01 — 정의가 M01 로 옮긴 뒤 옛 /api/m02 주소 404 로 정의 없이 처음값 표로 그려짐
- 종류 캐시가 받는 정의 · 판 확인 주소를 /m01/structure-definition(/version) 으로 - 시험 도우미 helper_323_9 가짜 서버 주소도 /m01 로 따라감 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -199,14 +199,14 @@ async function requestJson<T>(path: string, init: RequestInit = {}): Promise<T>
|
||||
}
|
||||
}
|
||||
|
||||
/** 타입 레지스트리 캐시 — 정의 판(`typesVersion`)이 바뀌면(M02 저장) 버리고 다시 받음(322-0). */
|
||||
/** 타입 레지스트리 캐시 — 정의 판(`typesVersion`)이 바뀌면(M01 저장) 버리고 다시 받음(322-0). */
|
||||
let typesCache: Promise<StructureType[]> | null = null;
|
||||
let typesVersion: number | null = null;
|
||||
|
||||
/** 정의 판이 캐시 판과 다르면 종류 캐시를 버림 — 버렸으면 true(B05 · B06 보기를 열 때 · 탭이 다시 보일 때). */
|
||||
export async function dropStaleStructureTypes(): Promise<boolean> {
|
||||
if (!typesCache || typesVersion === null) return false;
|
||||
const now = await requestJson<{ 판: number }>("/m02/structure-definition/version", {
|
||||
const now = await requestJson<{ 판: number }>("/m01/structure-definition/version", {
|
||||
method: "GET",
|
||||
})
|
||||
.then((payload) => payload.판)
|
||||
@@ -271,7 +271,7 @@ export function onStaleStructureTypes(reload: () => void): () => void {
|
||||
export function fetchStructureTypes(includeDisabled = false): Promise<StructureType[]> {
|
||||
if (!typesCache) {
|
||||
// 구조물 정의(48) 덧칸 — 못 받으면 옛 화면 그대로(정의 없음 = 지금 차례 · 2열)
|
||||
const definition = requestJson<StructureDefinition>("/m02/structure-definition", {
|
||||
const definition = requestJson<StructureDefinition>("/m01/structure-definition", {
|
||||
method: "GET",
|
||||
}).catch(() => null);
|
||||
typesCache = requestJson<StructureTypesResponse>("/projects/structure-types", {
|
||||
|
||||
@@ -182,7 +182,7 @@ export function shapeFields(
|
||||
}));
|
||||
}
|
||||
|
||||
/** 정의 한 벌(GET /m02/structure-definition) 중 화면이 쓰는 칸. */
|
||||
/** 정의 한 벌(GET /m01/structure-definition) 중 화면이 쓰는 칸. */
|
||||
export interface StructureDefinition {
|
||||
판?: number;
|
||||
구조물군?: Record<string, string>;
|
||||
|
||||
@@ -37,8 +37,8 @@ const server = {
|
||||
const puts = [];
|
||||
const reply = (body) => ({ ok: true, status: 200, json: async () => body });
|
||||
globalThis.fetch = async (url, init = {}) => {
|
||||
const at = url.replace(/^.*?(?=\/(m02|projects))/, "");
|
||||
if (at === "/m02/structure-definition") return reply({ 판: NOW, types: [] });
|
||||
const at = url.replace(/^.*?(?=\/(m01|projects))/, "");
|
||||
if (at === "/m01/structure-definition") return reply({ 판: NOW, types: [] });
|
||||
if (at === "/projects/structure-types") return reply({ types: [] });
|
||||
if (at.endsWith("/route/structures") && init.method === "PUT") {
|
||||
const body = JSON.parse(init.body);
|
||||
|
||||
Reference in New Issue
Block a user