fix: de-structure error

pull/3813/head
Arik Chakma 2 years ago
parent 0fa4533168
commit 9d8889a492
  1. 14
      src/components/Setting/UpdateProfileForm.tsx

@ -49,10 +49,12 @@ export default function UpdateProfileForm() {
setIsLoading(false); setIsLoading(false);
setName(data.name); setName(data.name);
setEmail(data.email); setEmail(data.email);
if (data.links) {
const { github, linkedin, website } = data.links; const { github, linkedin, website } = data.links;
setGithub(github); setGithub(github || '');
setLinkedin(linkedin); setLinkedin(linkedin || '');
setWebsite(website); setWebsite(website || '');
}
setMessage({ setMessage({
type: 'success', type: 'success',
message: 'Profile updated successfully', message: 'Profile updated successfully',
@ -95,9 +97,9 @@ export default function UpdateProfileForm() {
if (json.links) { if (json.links) {
const { github, linkedin, website } = json.links; const { github, linkedin, website } = json.links;
setGithub(github); setGithub(github || '');
setLinkedin(linkedin); setLinkedin(linkedin || '');
setWebsite(website); setWebsite(website || '');
} }
} else { } else {
throw new Error(json.message); throw new Error(json.message);

Loading…
Cancel
Save