Skip to content

Commit

Permalink
fix: change password dialog handle signin fail
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJustChew committed Aug 5, 2024
1 parent c96dd3a commit 0e0d558
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/components/Forms/ChangePasswordDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,18 @@ const ChangePasswordDialog = ({ open, setOpen, children }: PropsWithChildren<{ o

async function onSubmit(values: z.infer<typeof formSchema>) {
if (!user) return;
await signIn(user.studentid, values.newPassword)
setOpen(false);
toast({
title: "密碼更新成功",
})
const success = await signIn(user.studentid, values.newPassword)
if(!success) {
setOpen(false);
toast({
title: "密碼更新成功",
})
} else {
toast({
title: "密碼更新失敗",
})
}

}

return (
Expand Down

0 comments on commit 0e0d558

Please sign in to comment.