File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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) => {
327327async 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 : [ ] ,
You can’t perform that action at this time.
0 commit comments