minor fix
This commit is contained in:
parent
742e17351e
commit
01a8579158
|
@ -1,7 +1,7 @@
|
|||
import { Dispatch, SetStateAction, useEffect, useState } from "react";
|
||||
import { AccountSettings } from "@/types/global";
|
||||
import useAccountStore from "@/store/account";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { signOut, useSession } from "next-auth/react";
|
||||
import { faPenToSquare } from "@fortawesome/free-regular-svg-icons";
|
||||
import SubmitButton from "@/components/SubmitButton";
|
||||
import { toast } from "react-hot-toast";
|
||||
|
@ -50,22 +50,24 @@ export default function ChangePassword({
|
|||
|
||||
if (response.ok) {
|
||||
toast.success("Settings Applied!");
|
||||
togglePasswordFormModal();
|
||||
} else toast.error(response.data as string);
|
||||
|
||||
setSubmitLoader(false);
|
||||
if (
|
||||
user.username !== account.username ||
|
||||
user.name !== account.name ||
|
||||
user.email !== account.email
|
||||
) {
|
||||
update({
|
||||
username: user.username,
|
||||
email: user.username,
|
||||
name: user.name,
|
||||
});
|
||||
|
||||
if (
|
||||
(user.username !== account.username || user.name !== account.name) &&
|
||||
user.username &&
|
||||
user.email
|
||||
)
|
||||
update({ username: user.username, name: user.name });
|
||||
signOut();
|
||||
}
|
||||
|
||||
if (response.ok) {
|
||||
setUser({ ...user, newPassword: undefined });
|
||||
togglePasswordFormModal();
|
||||
}
|
||||
} else toast.error(response.data as string);
|
||||
} else {
|
||||
toast.error("Passwords do not match.");
|
||||
}
|
||||
|
|
|
@ -77,7 +77,6 @@ export default function ProfileSettings({
|
|||
|
||||
if (response.ok) {
|
||||
toast.success("Settings Applied!");
|
||||
toggleSettingsModal();
|
||||
|
||||
if (
|
||||
user.username !== account.username ||
|
||||
|
|
Ŝarĝante…
Reference in New Issue