small fix
This commit is contained in:
@@ -2,7 +2,7 @@ import { Dispatch, SetStateAction, useEffect, useState } from "react";
|
||||
import Checkbox from "../../Checkbox";
|
||||
import useAccountStore from "@/store/account";
|
||||
import { AccountSettings } from "@/types/global";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { signOut, useSession } from "next-auth/react";
|
||||
import { faPenToSquare } from "@fortawesome/free-regular-svg-icons";
|
||||
import SubmitButton from "../../SubmitButton";
|
||||
import { toast } from "react-hot-toast";
|
||||
@@ -59,18 +59,25 @@ export default function PrivacySettings({
|
||||
|
||||
if (response.ok) {
|
||||
toast.success("Settings Applied!");
|
||||
toggleSettingsModal();
|
||||
} else toast.error(response.data as string);
|
||||
|
||||
setSubmitLoader(false);
|
||||
if (
|
||||
user.email !== account.email ||
|
||||
user.username !== account.username ||
|
||||
user.name !== account.name
|
||||
) {
|
||||
update({
|
||||
username: user.username,
|
||||
email: user.email,
|
||||
name: user.name,
|
||||
});
|
||||
|
||||
if (user.username !== account.username || user.name !== account.name)
|
||||
update({ username: user.username, name: user.name });
|
||||
signOut();
|
||||
}
|
||||
|
||||
if (response.ok) {
|
||||
setUser({ ...user, newPassword: undefined });
|
||||
toggleSettingsModal();
|
||||
}
|
||||
} else toast.error(response.data as string);
|
||||
setSubmitLoader(false);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user