docs: update LLM guides for completed architecture phase
Refresh the development guidance to point to layered src GUIDE files and document Phase 4 completion, including AppShell extraction and page driver/component adoption for non-maintenance pages.docs: update LLM guides for completed architecture phase Refresh the development guidance to point to layered src GUIDE files and document Phase 4 completion, including AppShell extraction and page driver/component adoption for non-maintenance pages.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# Services Guide
|
||||
|
||||
`services` 是 HTTP 與外部 API 邊界。service 回傳資料,不持有 UI 狀態。
|
||||
|
||||
## 資料流
|
||||
|
||||
```txt
|
||||
component/view -> store/composable -> service module -> httpClient -> hooks
|
||||
```
|
||||
|
||||
## 規則
|
||||
|
||||
- 新 API 放在 `services/modules/<domain>.ts`。
|
||||
- 使用 `httpClient`,不要直接建立新的 ky instance。
|
||||
- 不 import component、view 或 store。
|
||||
- 不管理 loading、dialog、snackbar、AbortController lifecycle。
|
||||
- request option 可接收 `signal`。
|
||||
- 錯誤正規化交給既有 error/http hooks 流程。
|
||||
|
||||
## ky 注意事項
|
||||
|
||||
- 本專案使用 ky,不使用 axios。
|
||||
- JSON response 用 `.json<T>()`。
|
||||
- JSON payload 用 `json`,FormData 用 `body`。
|
||||
- 取消請求使用原生 `AbortController` 與 `signal`。
|
||||
- token 注入與 401 force logout 集中在 hooks,不在單一 API module 重寫。
|
||||
Reference in New Issue
Block a user