Skip to content

Commit

Permalink
troubleshooting migration
Browse files Browse the repository at this point in the history
  • Loading branch information
CreatedByBdr committed Sep 15, 2023
1 parent 6ea010c commit 525af25
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions workspaces/cms-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,29 +62,6 @@ export async function getJSON(
src: string,
context: EventContext<{}, any, Record<string, unknown>>
): Promise<any> {
if (import.meta.env.SSR || context) {
if (context) {
const res = await context.env.ASSETS.fetch(new URL("/" + src + ".json", "http://localhost:3000"))

return res.json()
} else if (import.meta.env.DEV) {
const fs = await import("node:fs/promises");
const path = await import("node:path");

return JSON.parse(
await fs.readFile(
path.join(process.cwd(), "../../public", src + ".json"),
"utf8"
)
);
} else {
const res = await fetch(
import.meta.env.VITE_SITE_URL + "/" + src + ".json"
);
return res.json();
}
}

const res = await fetch("/" + src + ".json");
return res.json();
}
Expand Down

0 comments on commit 525af25

Please sign in to comment.