fix: unable to add users from the admin page (#23869)
This commit is contained in:
1 parent
badc857bcd
commit
e9fd23d0d3
2 files changed
+11
-2
No files matched your search
@@ -30,7 +30,11 @@ type OptionValues = {
|
||||
identityProvider: Option;
|
||||
};
|
||||
|
||||
type FormValues = Pick<User, "avatarUrl" | "name" | "username" | "email" | "bio"> & OptionValues;
|
||||
type FormValues = Pick<
|
||||
User,
|
||||
"avatarUrl" | "name" | "username" | "email" | "bio" | "theme" | "defaultScheduleId" | "allowDynamicBooking"
|
||||
> &
|
||||
OptionValues;
|
||||
|
||||
export const UserForm = ({
|
||||
defaultValues,
|
||||
@@ -79,6 +83,9 @@ export const UserForm = ({
|
||||
username: defaultValues?.username,
|
||||
email: defaultValues?.email,
|
||||
bio: defaultValues?.bio,
|
||||
theme: defaultValues?.theme,
|
||||
defaultScheduleId: defaultValues?.defaultScheduleId,
|
||||
allowDynamicBooking: defaultValues?.allowDynamicBooking,
|
||||
locale: {
|
||||
value: defaultLocale,
|
||||
label: new Intl.DisplayNames(defaultLocale, { type: "language" }).of(defaultLocale) || "",
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
|
||||
import { getParserWithGeneric } from "@calcom/prisma/zod-utils";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
@@ -33,7 +34,8 @@ const UsersAddView = () => {
|
||||
<UserForm
|
||||
submitLabel="Add user"
|
||||
onSubmit={async (values) => {
|
||||
const parsedValues = userBodySchema.parse(values);
|
||||
const parser = getParserWithGeneric(userBodySchema);
|
||||
const parsedValues = parser(values);
|
||||
mutation.mutate(parsedValues);
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user