feat(web): 店铺管理页与页头平台选择器接入真实 API
- 页头平台选择器:PlatformProvider 加载平台目录与平台上下文
(X-Atlas-Platform-Id header),平台 id 仅作为非敏感 UI 偏好存
localStorage,默认取目录第一家(Ozon 优先)
- 店铺管理页覆盖 docs/api/stores-and-platforms.md 已实现接口:
游标分页列表、创建(202+operation)、编辑(If-Match 乐观锁、
409 刷新提示)、设为默认、重新验证凭据、仓库同步(422 脱敏
错误展示)、软删除(DEFAULT_STORE_REPLACEMENT_REQUIRED 提示)
- services/api.ts 新增 getList(保留 {data, meta} 分页信封)与
apiErrorCode;services/stores.ts 按契约生成 Idempotency-Key
- @atlas/contracts 补充只读响应类型 Platform / PlatformContext /
CursorPaginationMeta / StoreOperationResponse(无行为变更)
- API Key 仅存在于提交瞬间的内存表单,不落任何存储
- 浏览器实测:注册→平台切换→创建/编辑/设默认/删除保护/同步
错误路径→刷新会话恢复全部通过;typecheck + production build 通过
This commit is contained in:
@@ -75,3 +75,37 @@ export type Operation = {
|
||||
completed_at: string | null;
|
||||
error: { code: string; message: string } | null;
|
||||
};
|
||||
|
||||
/** GET /api/platforms 返回的平台目录项,能力字段无配置时为 null(docs/api/stores-and-platforms.md §1)。 */
|
||||
export type Platform = {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
supported_currencies: string[];
|
||||
default_market_code: string | null;
|
||||
default_locale: string | null;
|
||||
};
|
||||
|
||||
/** GET /api/platform-context 返回的页头上下文;没有默认店铺不是错误。 */
|
||||
export type PlatformContext = {
|
||||
platform: { id: string; code: string; name: string };
|
||||
default_store: {
|
||||
id: string;
|
||||
name: string;
|
||||
status: string;
|
||||
credential_status: string;
|
||||
} | null;
|
||||
store_count: number;
|
||||
};
|
||||
|
||||
/** 游标分页 meta(docs/api/conventions.md),next_cursor 为 null 表示没有更多数据。 */
|
||||
export type CursorPaginationMeta = {
|
||||
next_cursor: string | null;
|
||||
has_more: boolean;
|
||||
};
|
||||
|
||||
/** 创建门店与重新验证凭据等异步动作的 202 响应。 */
|
||||
export type StoreOperationResponse = {
|
||||
store: Store;
|
||||
operation: Operation;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user