Skip to content

Commit

Permalink
🔨 take PR feedback into account
Browse files Browse the repository at this point in the history
  • Loading branch information
danyx23 committed Sep 3, 2024
1 parent 9a63b85 commit ccc0ef7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion functions/grapher/[slug].ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { preflight, corsify } = cors({
})
// We collect the possible extensions here so we can easily take them into account
// when handling redirects
const extensions = {
export const extensions = {
configJson: ".config.json",
png: ".png",
svg: ".svg",
Expand Down
7 changes: 4 additions & 3 deletions functions/grapher/by-uuid/[uuid].ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import { Env } from "../../_common/env.js"
import { fetchGrapherConfig } from "../../_common/grapherRenderer.js"
import { IRequestStrict, Router, error, StatusError } from "itty-router"
import { handleThumbnailRequest } from "../../_common/reusableHandlers.js"
import { extensions } from "../[slug].js"

const router = Router<IRequestStrict, [URL, Env, string]>()
router
.get(
"/grapher/by-uuid/:uuid.config.json",
`/grapher/by-uuid/:uuid${extensions.configJson}`,
async ({ params: { uuid } }, { searchParams }, env, etag) =>
handleConfigRequest(uuid, searchParams, env, etag)
)
.get(
"/grapher/by-uuid/:uuid.png",
`/grapher/by-uuid/:uuid${extensions.png}`,
async ({ params: { uuid } }, { searchParams }, env, etag, ctx) =>
handleThumbnailRequest(
{ type: "uuid", id: uuid },
Expand All @@ -23,7 +24,7 @@ router
)
)
.get(
"/grapher/by-uuid/:uuid.svg",
`/grapher/by-uuid/:uuid${extensions.svg}`,
async ({ params: { uuid } }, { searchParams }, env, etag, ctx) =>
handleThumbnailRequest(
{ type: "uuid", id: uuid },
Expand Down

0 comments on commit ccc0ef7

Please sign in to comment.