diff --git a/backend/src/user/dto/updateUser.dto.ts b/backend/src/user/dto/updateUser.dto.ts index e38359d..eef29a2 100644 --- a/backend/src/user/dto/updateUser.dto.ts +++ b/backend/src/user/dto/updateUser.dto.ts @@ -1,4 +1,4 @@ import { PartialType } from "@nestjs/mapped-types"; -import { UserDTO } from "./user.dto"; +import { CreateUserDTO } from "./createUser.dto"; -export class UpdateUserDto extends PartialType(UserDTO) {} +export class UpdateUserDto extends PartialType(CreateUserDTO) {} diff --git a/frontend/src/components/admin/showCreateUserModal.tsx b/frontend/src/components/admin/showCreateUserModal.tsx index 6a7d4a2..1b34c3a 100644 --- a/frontend/src/components/admin/showCreateUserModal.tsx +++ b/frontend/src/components/admin/showCreateUserModal.tsx @@ -1,7 +1,6 @@ import { Button, Group, - Input, PasswordInput, Stack, Switch, @@ -51,7 +50,7 @@ const Body = ({
{ - console.log(values) + console.log(values); userService .create(values) .then(() => { @@ -72,10 +71,12 @@ const Body = ({ label="New password" {...form.getInputProps("password")} /> - - - - + diff --git a/frontend/src/components/admin/showUpdateUserModal.tsx b/frontend/src/components/admin/showUpdateUserModal.tsx index 57b50d6..dd8f671 100644 --- a/frontend/src/components/admin/showUpdateUserModal.tsx +++ b/frontend/src/components/admin/showUpdateUserModal.tsx @@ -4,6 +4,7 @@ import { Group, PasswordInput, Stack, + Switch, TextInput, Title, } from "@mantine/core"; @@ -36,8 +37,9 @@ const Body = ({ }) => { const accountForm = useForm({ initialValues: { - username: user?.username, - email: user?.email, + username: user.username, + email: user.email, + isAdmin: user.isAdmin, }, validate: yupResolver( yup.object().shape({ @@ -64,10 +66,7 @@ const Body = ({ id="accountForm" onSubmit={accountForm.onSubmit(async (values) => { userService - .update(user.id, { - email: values.email, - username: values.username, - }) + .update(user.id, values) .then(() => { getUsers(); modals.closeAll(); @@ -85,11 +84,17 @@ const Body = ({ label="Email" {...accountForm.getInputProps("email")} /> + - Passwort ändern + Change password
{