24 lines
608 B
JavaScript
24 lines
608 B
JavaScript
import EleventyFetch from '@11ty/eleventy-fetch';
|
|
|
|
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
|
|
|
export default async function fetchAllActivity() {
|
|
try {
|
|
const data = await EleventyFetch(`${POSTGREST_URL}/optimized_all_activity`, {
|
|
duration: '1h',
|
|
type: 'json',
|
|
fetchOptions: {
|
|
method: 'GET',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
|
}
|
|
}
|
|
});
|
|
|
|
return data?.[0] || [];
|
|
} catch (error) {
|
|
console.error('Error fetching activity:', error);
|
|
return [];
|
|
}
|
|
}
|