fix: TS errors in admin pages — unused imports, wrong api import path, implicit any types
All checks were successful
Deploy Admin Frontend / build-and-deploy (push) Successful in 8s

- Fix api import: @/lib/api → @/services/http-client
- Fix api.get usage: remove unsupported params arg, use URL params
- Fix unused imports (React, Card, Input)
- Add explicit generic types to api.get calls

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
WangDL 2026-05-24 16:20:42 +08:00
parent 9d080bf9e8
commit 11287e2c4f
3 changed files with 16 additions and 12 deletions

View File

@ -1,8 +1,7 @@
import React from 'react'
import { Card, Button, Statistic, Row, Col, Space, Input, Typography, message } from 'antd'
import { Card, Button, Statistic, Row, Col, Space, Typography, message } from 'antd'
import { ClearOutlined, ReloadOutlined, DeleteOutlined } from '@ant-design/icons'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import api from '@/lib/api'
import { api } from '@/services/http-client'
const { Title } = Typography
@ -11,7 +10,7 @@ export default function CacheAdmin() {
const { data: stats, isLoading } = useQuery({
queryKey: ['admin', 'cache-stats'],
queryFn: () => api.get('/admin-api/cache/stats').then(r => r.data?.data),
queryFn: () => api.get<any>('/admin-api/cache/stats'),
refetchInterval: 10_000,
})

View File

@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { useState } from 'react'
import { Card, Table, Button, Modal, Form, Input, Select, Tag, Space, Typography, message } from 'antd'
import { PlusOutlined, DeleteOutlined, EditOutlined } from '@ant-design/icons'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import api from '@/lib/api'
import { api } from '@/services/http-client'
const { Title } = Typography
@ -18,12 +18,12 @@ export default function NotificationAdmin() {
const { data: templates, isLoading } = useQuery({
queryKey: ['admin', 'notification-templates'],
queryFn: () => api.get('/admin-api/notifications/templates').then(r => r.data?.data ?? []),
queryFn: () => api.get<any[]>('/admin-api/notifications/templates').then(d => d ?? []),
})
const { data: sendLogs } = useQuery({
queryKey: ['admin', 'notification-logs'],
queryFn: () => api.get('/admin-api/notifications/send-log?limit=50').then(r => r.data?.data ?? []),
queryFn: () => api.get<any[]>('/admin-api/notifications/send-log?limit=50').then(d => d ?? []),
})
const saveMutation = useMutation({

View File

@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { Card, Table, Tag, Space, Input, Select, Typography } from 'antd'
import { useState } from 'react'
import { Table, Tag, Space, Input, Select, Typography } from 'antd'
import { SearchOutlined } from '@ant-design/icons'
import { useQuery } from '@tanstack/react-query'
import api from '@/lib/api'
import { api } from '@/services/http-client'
const { Title } = Typography
@ -16,7 +16,12 @@ export default function ReviewAdmin() {
const { data, isLoading } = useQuery({
queryKey: ['admin', 'reviews', search, statusFilter],
queryFn: () => api.get('/admin-api/reviews', { params: { search, status: statusFilter } }).then(r => r.data?.data ?? { items: [], total: 0 }),
queryFn: () => {
const params = new URLSearchParams()
if (search) params.set('search', search)
if (statusFilter) params.set('status', statusFilter)
return api.get<any>(`/admin-api/reviews?${params.toString()}`)
},
refetchInterval: 30_000,
})