From dc598e83d8d28d53cbb4eabda91e3416cc96e1a4 Mon Sep 17 00:00:00 2001 From: bgharbi Date: Sun, 17 Sep 2023 01:02:02 +0200 Subject: [PATCH] hard cotext --- .github/workflows/website.yml | 4 ++-- workspaces/cms-utils/src/index.ts | 26 ++------------------------ 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 277abb47dd9..13beab72f52 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -56,8 +56,8 @@ jobs: - name: Publish uses: cloudflare/pages-action@v1 with: - apiToken: ${{ secrets.NEW_CLOUDFLARE_API_TOKEN }} - accountId: ${{ secrets.NEW_CLOUDFLARE_ACCOUNT_ID }} + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} projectName: hardconfig directory: dist/client workingDirectory: workspaces/website diff --git a/workspaces/cms-utils/src/index.ts b/workspaces/cms-utils/src/index.ts index ff87adee9fe..c3fec7db3f3 100644 --- a/workspaces/cms-utils/src/index.ts +++ b/workspaces/cms-utils/src/index.ts @@ -62,31 +62,9 @@ export async function getJSON( src: string, context: EventContext<{}, any, Record> ): Promise { - if (import.meta.env.SSR || context) { - if (context) { - const res = await context.env.ASSETS.fetch(new URL("/" + src + ".json", "http://localhost:3000")) + const res = await context.env.ASSETS.fetch(new URL("/" + src + ".json", "http://localhost:3000")) + return res.json() - 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(); } export const convertStringTagsToArray = (commaSeperatedTags: string = "") => {