fix: form data empty error

pull/3813/head
Arik Chakma 2 years ago
parent 448c5cda5f
commit 6bf02c5687
  1. 8
      src/components/Login/AccountDropdown.astro
  2. 9
      src/components/Navigation.astro
  3. 3
      src/components/Setting/ChangePasswordForm.tsx
  4. 6
      src/components/Setting/UpdateProfileForm.tsx

@ -19,6 +19,14 @@
Your Profile Your Profile
</a> </a>
</li> </li>
<li class='px-1'>
<a
href='/settings/profile'
class='block rounded px-4 py-2 text-sm font-medium text-slate-100 hover:bg-slate-700'
>
Settings
</a>
</li>
<li class='px-1'> <li class='px-1'>
<button <button
class='block w-full rounded px-4 py-2 text-left text-sm font-medium text-slate-100 hover:bg-slate-700' class='block w-full rounded px-4 py-2 text-left text-sm font-medium text-slate-100 hover:bg-slate-700'

@ -79,6 +79,12 @@ import AccountNavigation from './Login/AccountNavigation.astro';
>Profile</a >Profile</a
> >
</li> </li>
<li id='settings-mobile-nav' class='hidden'>
<a
href='/settings/profile'
class='text-xl hover:text-blue-300 md:text-lg'>Settings</a
>
</li>
<li id='logout-mobile-nav' class='hidden'> <li id='logout-mobile-nav' class='hidden'>
<button class='text-xl text-red-300 hover:text-red-400 md:text-lg' <button class='text-xl text-red-300 hover:text-red-400 md:text-lg'
>Logout</button >Logout</button
@ -104,6 +110,7 @@ import AccountNavigation from './Login/AccountNavigation.astro';
const profileLink = document.getElementById('profile-mobile-nav'); const profileLink = document.getElementById('profile-mobile-nav');
const logoutButton = document.getElementById('logout-mobile-nav'); const logoutButton = document.getElementById('logout-mobile-nav');
const registerLink = document.getElementById('register-mobile-nav'); const registerLink = document.getElementById('register-mobile-nav');
const settingsLink = document.getElementById('settings-mobile-nav');
const token = Cookies.get(TOKEN_COOKIE_NAME); const token = Cookies.get(TOKEN_COOKIE_NAME);
@ -111,9 +118,11 @@ import AccountNavigation from './Login/AccountNavigation.astro';
profileLink?.classList.remove('hidden'); profileLink?.classList.remove('hidden');
logoutButton?.classList.remove('hidden'); logoutButton?.classList.remove('hidden');
registerLink?.classList.add('hidden'); registerLink?.classList.add('hidden');
settingsLink?.classList.remove('hidden');
} else { } else {
profileLink?.classList.add('hidden'); profileLink?.classList.add('hidden');
logoutButton?.classList.add('hidden'); logoutButton?.classList.add('hidden');
settingsLink?.classList.add('hidden');
registerLink?.classList.remove('hidden'); registerLink?.classList.remove('hidden');
} }

@ -58,9 +58,6 @@ export default function ChangePasswordForm() {
}); });
}; };
console.log(currentPassword, newPassword, newPasswordConfirmation);
console.log(`${TOKEN_COOKIE_NAME}=${Cookies.get(TOKEN_COOKIE_NAME)}`);
return ( return (
<form onSubmit={handleSubmit}> <form onSubmit={handleSubmit}>
<h2 className="text-3xl font-bold sm:text-4xl">Password</h2> <h2 className="text-3xl font-bold sm:text-4xl">Password</h2>

@ -28,9 +28,9 @@ export default function UpdateProfileForm() {
headers, headers,
body: JSON.stringify({ body: JSON.stringify({
name, name,
github, github: github === '' ? undefined : github,
linkedin, linkedin: linkedin === '' ? undefined : linkedin,
website, website: website === '' ? undefined : website,
}), }),
}) })
.then(async (res) => { .then(async (res) => {

Loading…
Cancel
Save