Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
BrownBrownBear committed Dec 23, 2024
1 parent c625768 commit 1640b39
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions apps/hub/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,33 @@ export default async function RootLayout(props: { children: React.ReactNode }) {
console.error("Error reading directory:", error);
}

const fetchedTokenList = await (tokenListUrl.startsWith("http")
? fetch(tokenListUrl).then((res) => res.json())
: (async () => {
try {
const filePath = path.join(
process.cwd(),
`${
process.env.NODE_ENV === "development" ? "public/" : ""
}${tokenListUrl}`,
);
const fileContent = readFileSync(filePath, "utf8");
return JSON.parse(fileContent);
} catch (error) {
console.error("Error reading token list file:", error);
return {}; // Return empty object as fallback
}
})());
// const fetchedTokenList = await (tokenListUrl.startsWith("http")
// ? fetch(tokenListUrl).then((res) => res.json())
// : (async () => {
// try {
// const filePath = path.join(
// process.cwd(),
// `${
// process.env.NODE_ENV === "development" ? "public/" : ""
// }${tokenListUrl}`,
// );
// const fileContent = readFileSync(filePath, "utf8");
// return JSON.parse(fileContent);
// } catch (error) {
// console.error("Error reading token list file:", error);
// return {}; // Return empty object as fallback
// }
// })());

const fetchedTokenList = await (async () => {
try {
const response = await fetch(tokenListUrl);
return await response.json();
} catch (error) {
console.error("Error fetching token list:", error);
return {}; // Return empty object as fallback
}
})();

return (
<html lang="en" className="bg-background">
Expand Down

0 comments on commit 1640b39

Please sign in to comment.