mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-13 00:03:27 +10:00
Merge pull request #1790 from gzsombor/import-fixes
Better error handling and more lenient on the imported values
This commit is contained in:
@ -182,11 +182,11 @@ export const ImportDialog = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
close();
|
close();
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
toast({
|
toast({
|
||||||
variant: "error",
|
variant: "error",
|
||||||
title: t`Oops, the server returned an error.`,
|
title: t`Oops, the server returned an error.`,
|
||||||
description: importError?.message,
|
description: error["message"],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -55,6 +55,13 @@ export class LinkedInParser implements Parser<JSZip, LinkedIn> {
|
|||||||
|
|
||||||
convert(data: LinkedIn) {
|
convert(data: LinkedIn) {
|
||||||
const result = JSON.parse(JSON.stringify(defaultResumeData)) as ResumeData;
|
const result = JSON.parse(JSON.stringify(defaultResumeData)) as ResumeData;
|
||||||
|
function avoidTooShort(name: string, len: number) {
|
||||||
|
if (!name || name.length<len) {
|
||||||
|
return "Unknown";
|
||||||
|
} else {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Profile
|
// Profile
|
||||||
if (data.Profile && data.Profile.length > 0) {
|
if (data.Profile && data.Profile.length > 0) {
|
||||||
@ -109,9 +116,9 @@ export class LinkedInParser implements Parser<JSZip, LinkedIn> {
|
|||||||
result.sections.education.items.push({
|
result.sections.education.items.push({
|
||||||
...defaultEducation,
|
...defaultEducation,
|
||||||
id: createId(),
|
id: createId(),
|
||||||
institution: education["School Name"],
|
institution: avoidTooShort(education["School Name"], 2),
|
||||||
studyType: education["Degree Name"],
|
studyType: avoidTooShort(education["Degree Name"], 2),
|
||||||
summary: education.Notes ?? "",
|
summary: avoidTooShort(education.Notes ?? "", 2),
|
||||||
date: `${education["Start Date"]} - ${education["End Date"] ?? "Present"}`,
|
date: `${education["Start Date"]} - ${education["End Date"] ?? "Present"}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user