fix: 修复一键生成页面废弃 API 调用(Bug A) #79

Merged
xiaoxia merged 1 commits from fix/p1-bug-fixes into develop 2026-06-28 18:23:08 +08:00
Owner

修复内容

Bug A(P1):GeneratePage 引用已废弃的 editPlans API

  • autoGenerateEditPlan 调用的 /edit-plans/auto-generate 端点在后端 Phase 1 重构中已被移除,会 404
  • tasks.ts 中新增 createGenerationTask 函数(USE_MOCK = true 模式,待后端生成接口适配扁平化架构后切换)
  • GeneratePage.tsx 改用 createGenerationTask 替代 autoGenerateEditPlan,移除对 @/api/editPlans 的引用

附带修复

  • window.location.href = "/history"useNavigate("/history")(避免全页刷新)

Bug B 说明

  • 经检查,UpgradeSubscription.tsxdisabled 条件已在 PR#77 中修复,当前代码已正确检查 plan_idbilling_cycle 两个条件,无需额外修改

变更文件

  • apps/web/src/api/tasks.ts — 新增 createGenerationTaskCreateGenerationTaskRequestCreateGenerationTaskResponse
  • apps/web/src/pages/generate/GeneratePage.tsx — 替换废弃 API 引用,修复导航方式

验证

  • TypeScript 编译通过(tsc --noEmit exit 0)
  • 无其他文件引用 @/api/editPlans
## 修复内容 ### Bug A(P1):GeneratePage 引用已废弃的 editPlans API - `autoGenerateEditPlan` 调用的 `/edit-plans/auto-generate` 端点在后端 Phase 1 重构中已被移除,会 404 - 在 `tasks.ts` 中新增 `createGenerationTask` 函数(`USE_MOCK = true` 模式,待后端生成接口适配扁平化架构后切换) - `GeneratePage.tsx` 改用 `createGenerationTask` 替代 `autoGenerateEditPlan`,移除对 `@/api/editPlans` 的引用 ### 附带修复 - `window.location.href = "/history"` → `useNavigate("/history")`(避免全页刷新) ### Bug B 说明 - 经检查,`UpgradeSubscription.tsx` 的 `disabled` 条件已在 PR#77 中修复,当前代码已正确检查 `plan_id` 和 `billing_cycle` 两个条件,无需额外修改 ## 变更文件 - `apps/web/src/api/tasks.ts` — 新增 `createGenerationTask`、`CreateGenerationTaskRequest`、`CreateGenerationTaskResponse` - `apps/web/src/pages/generate/GeneratePage.tsx` — 替换废弃 API 引用,修复导航方式 ## 验证 - TypeScript 编译通过(`tsc --noEmit` exit 0) - 无其他文件引用 `@/api/editPlans`
xiaoxia added 1 commit 2026-06-28 17:45:29 +08:00
fix: 修复一键生成页面废弃 API 调用及导航问题
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
f8cb32db56
Bug A: GeneratePage 引用已删除的 editPlans API(/edit-plans/auto-generate 不存在)
- 新增 createGenerationTask 到 tasks.ts(USE_MOCK 模式,待后端适配扁平化架构后切换)
- GeneratePage 改用 createGenerationTask 替代 autoGenerateEditPlan
- 移除对 @/api/editPlans 的引用

附带修复: window.location.href → useNavigate('/history')
xiaoxia merged commit 55e3b3fcb7 into develop 2026-06-28 18:23:08 +08:00
Sign in to join this conversation.