mirror of https://github.com/buster-so/buster.git
org updates
This commit is contained in:
parent
b2f8a349cc
commit
a565b0aaff
|
@ -80,8 +80,8 @@ export const NewUserController = () => {
|
|||
<Input
|
||||
placeholder="What is your full name"
|
||||
className="w-full"
|
||||
value={name}
|
||||
defaultValue={user?.name}
|
||||
value={name || ''}
|
||||
defaultValue={user?.name || ''}
|
||||
name="name"
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
/>
|
||||
|
@ -90,10 +90,10 @@ export const NewUserController = () => {
|
|||
className="w-full"
|
||||
name="company"
|
||||
disabled={!!userOrganizations?.name}
|
||||
value={company}
|
||||
value={company || ''}
|
||||
onChange={(e) => setCompany(e.target.value)}
|
||||
onPressEnter={handleSubmit}
|
||||
defaultValue={userOrganizations?.name}
|
||||
defaultValue={userOrganizations?.name || ''}
|
||||
/>
|
||||
<Button
|
||||
variant="black"
|
||||
|
|
|
@ -20,17 +20,15 @@ export const useUserOrganization = ({
|
|||
const onCreateUserOrganization = useMemoizedFn(
|
||||
async ({ name, company }: { name: string; company: string }) => {
|
||||
const alreadyHasOrganization = !!userResponse?.organizations?.[0];
|
||||
if (!alreadyHasOrganization && userResponse) {
|
||||
await Promise.all([
|
||||
createOrganization({ name: company }),
|
||||
updateUserInfo({
|
||||
userId: userResponse.user.id,
|
||||
name
|
||||
})
|
||||
]);
|
||||
|
||||
await refetchUserResponse();
|
||||
}
|
||||
if (!alreadyHasOrganization) await createOrganization({ name: company });
|
||||
if (userResponse)
|
||||
await updateUserInfo({
|
||||
userId: userResponse.user.id,
|
||||
name
|
||||
});
|
||||
|
||||
await refetchUserResponse();
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue