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