Compare commits

...

3 commits

View file

@ -32,8 +32,17 @@ const compareContentDate = (a: Content, b: Content) => {
export const aggregateContent = async () => {
let content: Content[] = [];
content.push(...(await fetchInstagramContent()));
content.push(...(await fetchBlogPosts()));
try {
content.push(...(await fetchInstagramContent()));
} catch(e) {
console.error("Unable to fetch instagram content: ", e)
}
try {
content.push(...(await fetchBlogPosts()));
} catch(e) {
console.error("Unable to fetch ghost content: ", e)
}
content.sort(compareContentDate);
@ -62,6 +71,7 @@ export const fetchBlogPosts = async () => {
throw 'Not Found';
}
} catch (e) {
console.error(e)
throw new Error('Failed to communicate with Ghost');
}
@ -95,6 +105,7 @@ export const fetchInstagramContent = async () => {
);
if (!response.ok) {
console.error(response.status)
throw new Error('Failed to communicate with Instagram');
}