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/src/data/globals.js

28 lines
641 B
JavaScript

import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const fetchGlobals = async () => {
const { data, error } = await supabase
.from("optimized_globals")
.select("*")
.single();
if (error) {
console.error("Error fetching globals:", error);
return {};
}
return data;
};
export default async function () {
try {
return await fetchGlobals();
} catch (error) {
console.error("Error fetching and processing globals:", error);
return {};
}
}