fix: abort機制
This commit is contained in:
@@ -21,3 +21,10 @@
|
||||
## 資料流
|
||||
|
||||
store 可以呼叫 service module。component 不應繞過 store/composable 直接處理 token、session 或 HTTP hooks。
|
||||
|
||||
## 請求取消慣例
|
||||
|
||||
- 需要避免重複提交或快速切換造成的舊請求殘留時,在 store 層管理 `AbortController`。
|
||||
- 同一類請求使用固定 key(例如 `auth/login`、`menu/get-menu`),新請求前先取消舊請求。
|
||||
- service module 只接收 `signal`,不管理 controller lifecycle。
|
||||
- store 在 `finally` 清理該 key,在 `clear/logout` 清理全部 key。
|
||||
|
||||
Reference in New Issue
Block a user