- 서버 정본 `M02_SO_Options.py` · 길 `M02_SO_Router.py`(고쳐 씀 = 시스템 관리자 · 읽기 = 로그인) - 화면 `M02_SO_Options.ts` · 글자 `M02_SO_Text.ts` · API `M02_SO_Api.ts` · 스타일 `M02_SO_Style.css` - 길 주소 · 동작 그대로 · B05 · 시험은 경로만 고침 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MPcuokNm1ZR2kqgGGDfaJA
30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
/* =============================================================================
|
|
* M02_SO_Api.ts
|
|
* 구조물 옵션 보이기 서버 호출 — 서버 = `M02_SO_Router.py`(마스터 템플릿 `구조물옵션표시.json`)
|
|
* ========================================================================== */
|
|
|
|
import { call } from "../M02_MasterTemplete_Api_Fetch";
|
|
|
|
export interface OptionKind {
|
|
type_id: string;
|
|
group: string;
|
|
name: string;
|
|
/** 거짓이면 B05 선택지에 안 나오는 종류 */
|
|
enabled: boolean;
|
|
options: { key: string; label: string; phase: "b05" | "detail"; required: boolean }[];
|
|
}
|
|
|
|
/** 판 · 표시(숨긴 것만 `{종류: {옵션: false}}`) · 종류(옵션이 있는 것과 그 옵션) */
|
|
export interface OptionsDoc {
|
|
판: string;
|
|
표시: Record<string, Record<string, false>>;
|
|
종류: OptionKind[];
|
|
}
|
|
|
|
export const fetchStructureOptions = (): Promise<OptionsDoc> =>
|
|
call("/layers/system/structure-options"); // 읽기 = 로그인 누구나 · 고쳐 씀은 시스템 관리자
|
|
|
|
/** 고쳐 씀 — 숨긴 것만 보냄 · 낡은 판이면 StaleError · 돌려받는 것은 새 문서 */
|
|
export const saveStructureOptions = (판: string, 표시: OptionsDoc["표시"]): Promise<OptionsDoc> =>
|
|
call("/structure-options", { method: "PUT", body: JSON.stringify({ 판, 표시 }) });
|