refactor: 全量迁移前端 API 调用到统一 api-services 服务层
- 新建 api-services-raw.ts 导出原始 axios 方法供特殊端点使用 - 完成 api-services.ts 全领域覆盖(auth/employee/roster/dashboard/attendance/payroll/socialInsurance/commercialInsurance/termination/policies/evidence/audit/calendar/companyFiles/notifications/settings/ai/platform/portal/survey/search) - 迁移所有 47+ 页面文件:pages/、pages/roster/、pages/portal/、pages/platform/、pages/auth/、pages/dashboard/、pages/compliance/ - 移除所有直接 import api from '../../lib/api' 引用 - 修复 Termination.tsx / WorkProcess.tsx 中 string|null 类型错误 - 修复 SocialInsurance.tsx 中 api-services-raw delete 导入名 - 修复 PlatformLogin.tsx 变量遮蔽问题 - tsc --noEmit 零错误,vite build 成功
This commit is contained in:
@@ -2,7 +2,7 @@ import { useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { Eye, EyeOff } from 'lucide-react'
|
||||
import Logo from '../../components/ui/Logo'
|
||||
import api from '../../lib/api'
|
||||
import { authApi } from '../../lib/api-services'
|
||||
import { Input, Label } from '../../components/ui/Input'
|
||||
import Button from '../../components/ui/Button'
|
||||
|
||||
@@ -25,8 +25,8 @@ export default function ForgotPassword() {
|
||||
}
|
||||
setLoading(true)
|
||||
try {
|
||||
const res = await api.post('/auth/forgot-password/send-code', { phone }) as any
|
||||
setSentCode(res.data?.code || '')
|
||||
const res = await authApi.forgotPasswordSendCode(phone) as any
|
||||
setSentCode(res?.code || '')
|
||||
setStep(2)
|
||||
} catch (err: any) {
|
||||
setError(err.response?.data?.error?.message || '发送失败,请稍后重试')
|
||||
@@ -47,7 +47,7 @@ export default function ForgotPassword() {
|
||||
}
|
||||
setLoading(true)
|
||||
try {
|
||||
await api.post('/auth/forgot-password/verify', { phone, code, newPassword })
|
||||
await authApi.forgotPasswordVerify({ phone, code, newPassword })
|
||||
setSuccess(true)
|
||||
} catch (err: any) {
|
||||
setError(err.response?.data?.error?.message || '重置失败,请稍后重试')
|
||||
|
||||
Reference in New Issue
Block a user