org updates

This commit is contained in:
Nate Kelley 2025-03-04 13:11:05 -07:00
parent b2f8a349cc
commit a565b0aaff
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
2 changed files with 12 additions and 14 deletions

View File

@ -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"

View File

@ -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();
}
);