Skip to content

Commit

Permalink
Update AddAccountForm.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
zenzen-sol committed Apr 16, 2024
1 parent aab5add commit 829c32e
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions app/AddAccountForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const FormSchema = z.object({

const AddAccountForm: FC = () => {
const router = useRouter();
const { isLoaded, userId } = useAuth();
const { isLoaded } = useAuth();

const form = useForm<z.infer<typeof FormSchema>>({
mode: "onChange",
Expand All @@ -78,20 +78,7 @@ const AddAccountForm: FC = () => {

const onSubmit = async (values: z.infer<typeof FormSchema>) => {
try {
if (!userId) {
throw new Error("User not found.");
}

const valuesWithUserId: {
address: string;
name: string;
userId: string;
} = {
...values,
userId: userId,
};

saveOrUpdateAccount(valuesWithUserId);
saveOrUpdateAccount(values);
toast.success("Address has been created");
form.reset();
router.refresh();
Expand Down

0 comments on commit 829c32e

Please sign in to comment.