fix typing check

This commit is contained in:
Zhang Minghan 2023-11-08 12:16:48 +08:00
parent ea8331b20e
commit b40c60edd8
4 changed files with 28 additions and 12 deletions

View File

@ -5,7 +5,8 @@ import {
InvitationGenerateResponse,
InvitationResponse,
ModelChartResponse,
RequestChartResponse, UserResponse,
RequestChartResponse,
UserResponse,
} from "@/admin/types.ts";
import axios from "axios";
@ -92,7 +93,10 @@ export async function generateInvitation(
return response.data as InvitationGenerateResponse;
}
export async function getUserList(page: number, search: string): Promise<UserResponse> {
export async function getUserList(
page: number,
search: string,
): Promise<UserResponse> {
const response = await axios.get(
`/admin/user/list?page=${page}&search=${search}`,
);

View File

@ -62,7 +62,7 @@ export type UserData = {
is_subscribed: boolean;
total_month: number;
enterprise: boolean;
}
};
export type UserForm = {
data: UserData[];

View File

@ -1,6 +1,6 @@
import { useTranslation } from "react-i18next";
import { useToast } from "@/components/ui/use-toast.ts";
import {useEffect, useRef, useState} from "react";
import { useState } from "react";
import { UserForm, UserResponse } from "@/admin/types.ts";
import { getUserList } from "@/admin/api.ts";
import { useEffectAsync } from "@/utils/hook.ts";
@ -13,8 +13,14 @@ import {
TableRow,
} from "@/components/ui/table.tsx";
import { Button } from "@/components/ui/button.tsx";
import {ChevronLeft, ChevronRight, MoreHorizontal, RotateCw, Search} from "lucide-react";
import {Input} from "@/components/ui/input.tsx";
import {
ChevronLeft,
ChevronRight,
MoreHorizontal,
RotateCw,
Search,
} from "lucide-react";
import { Input } from "@/components/ui/input.tsx";
function UserTable() {
const { t } = useTranslation();
@ -43,7 +49,8 @@ function UserTable() {
<Input
className={`search`}
placeholder={t("admin.search-username")}
value={search} onChange={(e) => setSearch(e.target.value)}
value={search}
onChange={(e) => setSearch(e.target.value)}
/>
<Button size={`icon`} className={`flex-shrink-0 ml-2`} onClick={update}>
<Search className={`h-4 w-4`} />

View File

@ -575,11 +575,13 @@ const resources = {
action: "Action",
"search-username": "Search Username",
"quota-action": "Quota Change",
"quota-action-desc": "Please enter the quota change value (positive for increase, negative for decrease)",
"quota-action-desc":
"Please enter the quota change value (positive for increase, negative for decrease)",
"subscription-action": "Subscription Gift",
"subscription-action-desc": "Please enter the gift subscription months",
"operate-success": "Operate Success",
"operate-success-prompt": "Your operation has been successfully executed.",
"operate-success-prompt":
"Your operation has been successfully executed.",
"operate-failed": "Operate Failed",
"operate-failed-prompt": "Operation failed, reason: {{reason}}",
"updated-at": "Updated At",
@ -876,13 +878,16 @@ const resources = {
action: "Действие",
"search-username": "Поиск по имени пользователя",
"quota-action": "Изменение квоты",
"quota-action-desc": "Пожалуйста, введите значение изменения квоты (положительное для увеличения, отрицательное для уменьшения)",
"quota-action-desc":
"Пожалуйста, введите значение изменения квоты (положительное для увеличения, отрицательное для уменьшения)",
"subscription-action": "Подарок подписки",
"subscription-action-desc": "Пожалуйста, введите количество месяцев подарочной подписки",
"subscription-action-desc":
"Пожалуйста, введите количество месяцев подарочной подписки",
"operate-success": "Успешно",
"operate-success-prompt": "Ваша операция была успешно выполнена.",
"operate-failed": "Не удалось",
"operate-failed-prompt": "Не удалось выполнить операцию, причина: {{reason}}",
"operate-failed-prompt":
"Не удалось выполнить операцию, причина: {{reason}}",
"updated-at": "Обновлено",
"used-true": "Использовано",
"used-false": "Не использовано",