This repository has been archived on 2025-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
coryd.dev-eleventy/workers/dynamic-pages/utils/fetchers.js

26 lines
549 B
JavaScript

export const fetchDataByUrl = async (supabase, table, url) => {
const { data, error } = await supabase
.from(table)
.select("*")
.eq("url", url)
.single();
if (error) {
console.error(`Error fetching from ${table}:`, error);
return null;
}
return data;
};
export const fetchGlobals = async (supabase) => {
const { data, error } = await supabase
.from("optimized_globals")
.select("*")
.single();
if (error) {
console.error("Error fetching globals:", error);
return {};
}
return data;
};