Skip to content

Commit

Permalink
error handle libguide fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Nov 21, 2023
1 parent b9652d1 commit df95964
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/libguides.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ const fetchLibGuides = async ({accountId, subjectId}: { accountId?: number, subj
params.set('account_ids', accountId.toString());
}

const guideData = await fetch(`https://lgapi-us.libapps.com/1.2/guides?${params.toString()}`, guidesConfig)
.then(response => response.json())
const response = await fetch(`https://lgapi-us.libapps.com/1.2/guides?${params.toString()}`, guidesConfig);
if(!response.ok){
console.error('Libguide error: '+await response.text());
return [];
}
const guideData = await response.json()

const guides: Guide[] = [];
guideData.filter(guide => guide.status === 1)
Expand Down

1 comment on commit df95964

@vercel
Copy link

@vercel vercel bot commented on df95964 Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.