diff --git a/client/src/components/Header.tsx b/client/src/components/Header.tsx index 2872408..3a65726 100644 --- a/client/src/components/Header.tsx +++ b/client/src/components/Header.tsx @@ -70,7 +70,7 @@ export default function Header({ title, additionalContent }: HeaderProps) { closeDrawer={closeEditDrawer} type="edit" > - {user?.id && } + {user?.id && } ); diff --git a/client/src/components/UserEdit.tsx b/client/src/components/UserEdit.tsx index 4b89020..70740db 100644 --- a/client/src/components/UserEdit.tsx +++ b/client/src/components/UserEdit.tsx @@ -1,8 +1,8 @@ import { UserService } from '@/services/userService'; import { useUserSelector } from '@/store/userStore'; -import { User, UserUpdate } from '@/types/user'; +import { UserUpdate } from '@/types/user'; import { LoadingOutlined } from '@ant-design/icons'; -import { Button, Form, Input, Select, Spin } from 'antd'; +import { Button, Form, Input, message, Select, Spin } from 'antd'; import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -10,17 +10,19 @@ const { Option } = Select; interface UserEditProps { userId?: number; + closeDrawer: () => void; } -export default function UserEdit({ userId }: UserEditProps) { +export default function UserEdit({ userId, closeDrawer }: UserEditProps) { const currentUser = useUserSelector(); const [form] = Form.useForm(); const { t } = useTranslation(); - const [user, setUser] = useState({ + const [user, setUser] = useState({ id: 0, name: '', login: '', email: '', + password: '', bindTenantId: '', role: 'VIEWER', meta: {}, @@ -53,10 +55,13 @@ export default function UserEdit({ userId }: UserEditProps) { }); if (Object.keys(updatedUser).length > 0) { + console.log('updateUser', userId, updatedUser); await UserService.updateUser(userId!, updatedUser); } setLoading(false); + message.info(t('editAccountMessage'), 4); + closeDrawer(); }; return ( diff --git a/client/src/config/i18n.ts b/client/src/config/i18n.ts index 360cde1..c3ea6eb 100644 --- a/client/src/config/i18n.ts +++ b/client/src/config/i18n.ts @@ -49,6 +49,7 @@ i18n createdAt: 'Created', saving: 'Saving...', createdAccountMessage: 'User successfully created!', + editAccountMessage: 'User successfully updated!', you: '(You)', }, }, @@ -91,6 +92,7 @@ i18n createdAt: 'Создано', saving: 'Сохранение...', createdAccountMessage: 'Пользователь успешно создан!', + editAccountMessage: 'Пользователь успешно обновлен!', you: '(Вы)', }, }, diff --git a/client/src/pages/AccountsPage.tsx b/client/src/pages/AccountsPage.tsx index 317cfee..7c65e2e 100644 --- a/client/src/pages/AccountsPage.tsx +++ b/client/src/pages/AccountsPage.tsx @@ -123,6 +123,15 @@ export default function AccountsPage() { title: t('createdAt'), dataIndex: 'createdAt', key: 'createdAt', + render: (text) => ( +
+ {new Date(text).toLocaleString('ru', { + year: '2-digit', + month: '2-digit', + day: '2-digit', + })} +
+ ), }, { title: t('status'), @@ -191,7 +200,7 @@ export default function AccountsPage() { closeDrawer={closeEditDrawer} type="edit" > - + ); diff --git a/client/src/pages/LoginPage.tsx b/client/src/pages/LoginPage.tsx index b6b65e9..c2c74c7 100644 --- a/client/src/pages/LoginPage.tsx +++ b/client/src/pages/LoginPage.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Form, Input, Button, Typography } from 'antd'; +import { Form, Input, Button, Typography, message } from 'antd'; import { EyeInvisibleOutlined, EyeTwoTone, @@ -45,7 +45,11 @@ export default function LoginPage() { /> -
+