- 앞 커밋 글 그대로(층 · 부름 common_util_m02_call · 찾아 넣기 창 StackFind 주입 · 단위 고르기 부품 상자 · 합계 상자 A00 · 기계 칸 부품) - 앞 커밋에서 git add 가 옛 경로에 걸려 고친 파일이 빠짐 — 두 커밋을 같이 올림 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
1.3 KiB
TypeScript
24 lines
1.3 KiB
TypeScript
/* =============================================================================
|
|
* M02_DF_Api.ts
|
|
* 기계 이름 · 끈 기계 읽기 — 서버 `GET /api/m02/df/machine-names` · `machine-off`(`M02_DF_Router.py`)
|
|
* 부르는 곳 = 옵션 기계 이름(`formula_doc_options`) · 단위 표준 표 읽기는 단위 고르기(`ui_template_unit_pick`)로 옮김(856-4)
|
|
* ========================================================================== */
|
|
|
|
import { API_BASE_URL } from "@config/config_frontend";
|
|
|
|
let machineNames: Promise<Record<string, string>> | null = null;
|
|
|
|
/** 기계 원문번호 → 「이름 규격」 — 한 번 받아 둠(못 받으면 빈 표 · 다음에 다시) */
|
|
export function cfMachineNames(): Promise<Record<string, string>> {
|
|
machineNames ??= fetch(`${API_BASE_URL}/m02/df/machine-names`, { credentials: "include" })
|
|
.then((r) => (r.ok ? (r.json() as Promise<Record<string, string>>) : Promise.reject()))
|
|
.catch(() => ((machineNames = null), {}));
|
|
return machineNames;
|
|
}
|
|
|
|
/** 끈 기계 원문번호(842-2) — 이름과 함께 한 번 받아 둠(못 받으면 빈 목록) */
|
|
export const cfMachineOff = (): Promise<string[]> =>
|
|
fetch(`${API_BASE_URL}/m02/df/machine-off`, { credentials: "include" })
|
|
.then((r) => (r.ok ? (r.json() as Promise<string[]>) : []))
|
|
.catch(() => []);
|