Skip to content

Commit

Permalink
hard cotext
Browse files Browse the repository at this point in the history
  • Loading branch information
CreatedByBdr committed Sep 16, 2023
1 parent 2fd33df commit dc598e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 2 additions & 24 deletions workspaces/cms-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,31 +62,9 @@ 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"))
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 = "") => {
Expand Down

0 comments on commit dc598e8

Please sign in to comment.