fix: rename name to displayName in AdminUser type and page

This commit is contained in:
Kirill
2026-05-21 20:58:50 +05:00
parent 2751332356
commit 7a9e44bc5c
4 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -17,14 +17,14 @@ export async function fetchAdminUsers(params?: {
return data
}
export async function createAdminUser(body: { email: string; name?: string | null }): Promise<AdminUser> {
export async function createAdminUser(body: { email: string; displayName?: string | null }): Promise<AdminUser> {
const { data } = await apiClient.post<AdminUser>('admin/users', body)
return data
}
export async function updateAdminUser(
id: string,
body: Partial<{ email: string; name: string | null }>,
body: Partial<{ email: string; displayName: string | null }>,
): Promise<AdminUser> {
const { data } = await apiClient.patch<AdminUser>(`admin/users/${id}`, body)
return data
+1 -1
View File
@@ -1,7 +1,7 @@
export type AdminUser = {
id: string
email: string
name: string | null
displayName: string | null
avatar?: string | null
avatarType?: string | null
avatarStyle?: string | null
@@ -25,10 +25,10 @@ import { UserAvatar } from '@/shared/ui/UserAvatar'
type UserFormState = {
email: string
name: string
displayName: string
}
const emptyUserForm = (): UserFormState => ({ email: '', name: '' })
const emptyUserForm = (): UserFormState => ({ email: '', displayName: '' })
function formatDt(v: string) {
try {
@@ -78,7 +78,7 @@ export function AdminUsersPage() {
const v = userForm.getValues()
await createAdminUser({
email: v.email.trim(),
name: v.name.trim() || null,
displayName: v.displayName.trim() || null,
})
},
onSuccess: () => {
@@ -92,7 +92,7 @@ export function AdminUsersPage() {
const v = userForm.getValues()
await updateAdminUser(editing!.id, {
email: v.email.trim(),
name: v.name.trim() || null,
displayName: v.displayName.trim() || null,
})
},
onSuccess: () => {
@@ -119,7 +119,7 @@ export function AdminUsersPage() {
openEditDialog(u)
userForm.reset({
email: u.email,
name: u.name ?? '',
displayName: u.displayName ?? '',
})
}
@@ -201,7 +201,7 @@ export function AdminUsersPage() {
/>
</TableCell>
<TableCell>{u.email}</TableCell>
<TableCell>{u.name ?? '—'}</TableCell>
<TableCell>{u.displayName ?? '—'}</TableCell>
<TableCell>{formatDt(u.createdAt)}</TableCell>
<TableCell>{formatDt(u.updatedAt)}</TableCell>
<TableCell align="right">
@@ -264,7 +264,7 @@ export function AdminUsersPage() {
/>
<Controller
control={userForm.control}
name="name"
name="displayName"
render={({ field }) => <TextField label="Имя/ник" fullWidth {...field} />}
/>
</Stack>
Binary file not shown.