添加密码登录&调整接口数据展示&配置底部导航跳转
This commit is contained in:
@@ -12,7 +12,7 @@ import zod from 'zod'
|
||||
import {merge} from '@/lib/utils'
|
||||
import {Button} from '@/components/ui/button'
|
||||
import {useState} from 'react'
|
||||
import {listAccount} from '@/actions/dashboard'
|
||||
import {statisticsResourceUsage} from '@/actions/dashboard'
|
||||
import {ExtraResp} from '@/lib/api'
|
||||
import {toast} from 'sonner'
|
||||
import {addDays, format} from 'date-fns'
|
||||
@@ -20,19 +20,13 @@ import {Label} from '@/components/ui/label'
|
||||
import {ChartConfig, ChartContainer} from '@/components/ui/chart'
|
||||
import {CartesianGrid, XAxis, YAxis, Tooltip, Area, AreaChart, Legend} from 'recharts'
|
||||
|
||||
type ChartDataItem = {
|
||||
date: string
|
||||
count: number
|
||||
count2?: number
|
||||
}
|
||||
|
||||
type ChartsProps = {
|
||||
initialData?: ExtraResp<typeof listAccount>
|
||||
initialData?: ExtraResp<typeof statisticsResourceUsage>
|
||||
}
|
||||
|
||||
export default function Charts({initialData}: ChartsProps) {
|
||||
// const [submittedData, setSubmittedData] = useState<ExtraReq<typeof listAccount>>()
|
||||
const [submittedData, setSubmittedData] = useState<ExtraResp<typeof listAccount>>(initialData || [])
|
||||
const [submittedData, setSubmittedData] = useState<ExtraResp<typeof statisticsResourceUsage>>(initialData || [])
|
||||
const formSchema = zod.object({
|
||||
resource_no: zod.string().optional(),
|
||||
create_after: zod.date().optional(),
|
||||
@@ -58,7 +52,7 @@ export default function Charts({initialData}: ChartsProps) {
|
||||
create_before: value.create_before ?? today,
|
||||
}
|
||||
|
||||
const resp = await listAccount(res)
|
||||
const resp = await statisticsResourceUsage(res)
|
||||
if (!resp.success) {
|
||||
toast.error('接口请求失败:' + resp.message)
|
||||
return
|
||||
@@ -149,7 +143,7 @@ const config = {
|
||||
} satisfies ChartConfig
|
||||
|
||||
type DashboardChartProps = {
|
||||
data: ExtraResp<typeof listAccount>
|
||||
data: ExtraResp<typeof statisticsResourceUsage>
|
||||
}
|
||||
|
||||
function DashboardChart(props: DashboardChartProps) {
|
||||
|
||||
Reference in New Issue
Block a user