small improvements

This commit is contained in:
Daniel 2023-05-27 21:30:48 +03:30
parent aef0a90f43
commit 10727937b5
2 changed files with 3 additions and 13 deletions

View File

@ -84,18 +84,16 @@ export default function UserSettings({ toggleSettingsModal }: Props) {
};
const submit = async () => {
console.log(user);
await updateAccount({
const response = await updateAccount({
...user,
});
console.log(account);
setPasswordForm(undefined, undefined);
if (user.email !== account.email || user.name !== account.name)
update({ email: user.email, name: user.name });
if (response) toggleSettingsModal();
};
return (
@ -104,13 +102,6 @@ export default function UserSettings({ toggleSettingsModal }: Props) {
<p className="text-sky-600">Profile Settings</p>
{user.email !== account.email || user.name !== account.name ? (
<p className="text-gray-500 text-sm sm:w-1/2">
Note: The page will be refreshed to apply the changes of "Email" or
"Display Name".
</p>
) : null}
<div className="grid sm:grid-cols-2 gap-3 auto-rows-auto">
<div className="flex flex-col gap-3">
<div>

View File

@ -4,7 +4,6 @@
// You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
import { create } from "zustand";
import { User } from "@prisma/client";
import { AccountSettings } from "@/types/global";
import avatarExists from "@/lib/client/avatarExists";