Skip to content

Commit bd55e96

Browse files
committed
build issue fix
1 parent 0ae911c commit bd55e96

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

www/lib/resume.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ const ResumeDocument = ({ data }: { data: ResumeData }) => (
313313
</Document>
314314
);
315315

316-
const getLinkedInUsername = (userProfile: Profile | any) => {
316+
const getLinkedInUsername = (userProfile: Profile ) => {
317317
if (!userProfile) return null;
318318
const linkedInAccount = userProfile?.social_accounts?.find(
319319
(account: SocialAccount) => account.provider === "linkedin"
@@ -327,8 +327,17 @@ const getLinkedInUsername = (userProfile: Profile | any) => {
327327
async function getResumeData(username: string): Promise<ResumeData> {
328328
const userProfile = await getProfileData(username);
329329
const userProjects = await getProjectData(username);
330+
if (!userProfile || !userProjects) {
331+
throw new Error("User profile or projects not found");
332+
}
333+
if (!userProfile?.social_accounts) {
334+
userProfile.social_accounts = [];
335+
}
336+
330337
const linkedInUsername = getLinkedInUsername(userProfile);
331-
const userLinkedInProfile = await getLinkedInProfileData(linkedInUsername);
338+
let userLinkedInProfile = null;
339+
if (linkedInUsername) userLinkedInProfile = await getLinkedInProfileData(linkedInUsername);
340+
332341

333342
const defaultLinkedInProfile: LinkedInProfile = {
334343
experience: [],

0 commit comments

Comments
 (0)