forked from baron/baron-sso
fix(adminfront): fix Biome lint errors by removing explicit any types
This commit is contained in:
@@ -12,11 +12,14 @@ import {
|
||||
Save,
|
||||
Trash2,
|
||||
UserCheck,
|
||||
UserMinus,
|
||||
Users,
|
||||
} from "lucide-react";
|
||||
import * as React from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import {
|
||||
type FieldErrors,
|
||||
type UseFormRegister,
|
||||
useForm,
|
||||
} from "react-hook-form";
|
||||
import { Link, useNavigate, useParams } from "react-router-dom";
|
||||
import { Badge } from "../../components/ui/badge";
|
||||
import { Button } from "../../components/ui/button";
|
||||
@@ -35,7 +38,6 @@ import {
|
||||
type UserUpdateRequest,
|
||||
deleteUser,
|
||||
fetchMe,
|
||||
fetchTenant,
|
||||
fetchTenants,
|
||||
fetchUser,
|
||||
updateUser,
|
||||
@@ -52,6 +54,10 @@ type UserSchemaField = {
|
||||
validation?: string;
|
||||
};
|
||||
|
||||
type UserFormValues = Omit<UserUpdateRequest, "metadata"> & {
|
||||
metadata: Record<string, Record<string, string | number | boolean>>;
|
||||
};
|
||||
|
||||
function TenantMetadataFields({
|
||||
tenant,
|
||||
schema,
|
||||
@@ -60,8 +66,8 @@ function TenantMetadataFields({
|
||||
}: {
|
||||
tenant: { id: string; name: string; slug: string };
|
||||
schema: UserSchemaField[];
|
||||
register: any;
|
||||
errors: any;
|
||||
register: UseFormRegister<UserFormValues>;
|
||||
errors: FieldErrors<UserFormValues>;
|
||||
}) {
|
||||
if (schema.length === 0) return null;
|
||||
|
||||
@@ -107,7 +113,7 @@ function TenantMetadataFields({
|
||||
className={
|
||||
field.type === "boolean" ? "w-auto h-auto" : "h-8 text-sm"
|
||||
}
|
||||
{...register(`metadata.${tenant.id}.${field.key}`, {
|
||||
{...register(`metadata.${tenant.id}.${field.key}` as const, {
|
||||
required: field.required
|
||||
? t(
|
||||
"msg.admin.users.detail.form.field_required",
|
||||
@@ -149,10 +155,6 @@ function TenantMetadataFields({
|
||||
);
|
||||
}
|
||||
|
||||
type UserFormValues = Omit<UserUpdateRequest, "metadata"> & {
|
||||
metadata: Record<string, Record<string, any>>;
|
||||
};
|
||||
|
||||
function UserDetailPage() {
|
||||
const params = useParams<{ id: string }>();
|
||||
const userId = params.id ?? "";
|
||||
@@ -191,7 +193,6 @@ function UserDetailPage() {
|
||||
handleSubmit,
|
||||
reset,
|
||||
watch,
|
||||
setValue,
|
||||
formState: { errors },
|
||||
} = useForm<UserFormValues>({
|
||||
defaultValues: {
|
||||
@@ -261,7 +262,11 @@ function UserDetailPage() {
|
||||
department: user.department || "",
|
||||
position: user.position || "",
|
||||
jobTitle: user.jobTitle || "",
|
||||
metadata: user.metadata || {},
|
||||
metadata:
|
||||
(user.metadata as unknown as Record<
|
||||
string,
|
||||
Record<string, string | number | boolean>
|
||||
>) || {},
|
||||
});
|
||||
}
|
||||
}, [user, reset]);
|
||||
@@ -326,7 +331,10 @@ function UserDetailPage() {
|
||||
}),
|
||||
);
|
||||
|
||||
mutation.mutate({ ...data, metadata: cleanMetadata });
|
||||
mutation.mutate({
|
||||
...data,
|
||||
metadata: cleanMetadata as Record<string, unknown>,
|
||||
});
|
||||
};
|
||||
|
||||
const handleDelete = () => {
|
||||
|
||||
Reference in New Issue
Block a user