fix: de-structure error

pull/3813/head
Arik Chakma 2 years ago
parent 0fa4533168
commit 9d8889a492
  1. 16
      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);
const { github, linkedin, website } = data.links; if (data.links) {
setGithub(github); const { github, linkedin, website } = data.links;
setLinkedin(linkedin); setGithub(github || '');
setWebsite(website); setLinkedin(linkedin || '');
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