small fix
This commit is contained in:
parent
35bece5f49
commit
0e31e92c35
|
@ -52,13 +52,13 @@ export default function ChangePassword({
|
||||||
toast.success("Settings Applied!");
|
toast.success("Settings Applied!");
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
user.email !== account.email ||
|
||||||
user.username !== account.username ||
|
user.username !== account.username ||
|
||||||
user.name !== account.name ||
|
user.name !== account.name
|
||||||
user.email !== account.email
|
|
||||||
) {
|
) {
|
||||||
update({
|
update({
|
||||||
username: user.username,
|
username: user.username,
|
||||||
email: user.username,
|
email: user.email,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ export default function ChangePassword({
|
||||||
} else {
|
} else {
|
||||||
toast.error("Passwords do not match.");
|
toast.error("Passwords do not match.");
|
||||||
}
|
}
|
||||||
|
setSubmitLoader(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Dispatch, SetStateAction, useEffect, useState } from "react";
|
||||||
import Checkbox from "../../Checkbox";
|
import Checkbox from "../../Checkbox";
|
||||||
import useAccountStore from "@/store/account";
|
import useAccountStore from "@/store/account";
|
||||||
import { AccountSettings } from "@/types/global";
|
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 { faPenToSquare } from "@fortawesome/free-regular-svg-icons";
|
||||||
import SubmitButton from "../../SubmitButton";
|
import SubmitButton from "../../SubmitButton";
|
||||||
import { toast } from "react-hot-toast";
|
import { toast } from "react-hot-toast";
|
||||||
|
@ -59,18 +59,25 @@ export default function PrivacySettings({
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
toast.success("Settings Applied!");
|
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)
|
signOut();
|
||||||
update({ username: user.username, name: user.name });
|
}
|
||||||
|
|
||||||
if (response.ok) {
|
|
||||||
setUser({ ...user, newPassword: undefined });
|
setUser({ ...user, newPassword: undefined });
|
||||||
toggleSettingsModal();
|
toggleSettingsModal();
|
||||||
}
|
} else toast.error(response.data as string);
|
||||||
|
setSubmitLoader(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -79,13 +79,13 @@ export default function ProfileSettings({
|
||||||
toast.success("Settings Applied!");
|
toast.success("Settings Applied!");
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
user.email !== account.email ||
|
||||||
user.username !== account.username ||
|
user.username !== account.username ||
|
||||||
user.name !== account.name ||
|
user.name !== account.name
|
||||||
user.email !== account.email
|
|
||||||
) {
|
) {
|
||||||
update({
|
update({
|
||||||
username: user.username,
|
username: user.username,
|
||||||
email: user.username,
|
email: user.email,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -175,6 +175,14 @@ export default function ProfileSettings({
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : undefined}
|
) : undefined}
|
||||||
|
|
||||||
|
{user.username !== account.username ||
|
||||||
|
user.name !== account.name ||
|
||||||
|
user.email !== account.email ? (
|
||||||
|
<p className="text-gray-500">
|
||||||
|
You will need to log back in after you apply the changes.
|
||||||
|
</p>
|
||||||
|
) : undefined}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,6 @@ export default function UserModal({
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const [user, setUser] = useState<AccountSettings>(activeUser);
|
const [user, setUser] = useState<AccountSettings>(activeUser);
|
||||||
|
|
||||||
console.log(activeUser);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
<Tab.Group defaultIndex={defaultIndex}>
|
<Tab.Group defaultIndex={defaultIndex}>
|
||||||
|
|
|
@ -116,8 +116,6 @@ export const authOptions: AuthOptions = {
|
||||||
PRICE_ID
|
PRICE_ID
|
||||||
);
|
);
|
||||||
|
|
||||||
subscription.isSubscriber;
|
|
||||||
|
|
||||||
if (subscription.subscriptionCanceledAt) {
|
if (subscription.subscriptionCanceledAt) {
|
||||||
token.subscriptionCanceledAt = subscription.subscriptionCanceledAt;
|
token.subscriptionCanceledAt = subscription.subscriptionCanceledAt;
|
||||||
} else token.subscriptionCanceledAt = undefined;
|
} else token.subscriptionCanceledAt = undefined;
|
||||||
|
|
Ŝarĝante…
Reference in New Issue