Skip to content

Commit

Permalink
Change multi-dim HTTP API to PUT
Browse files Browse the repository at this point in the history
  • Loading branch information
rakyi committed Oct 31, 2024
1 parent 104d8ae commit 51cca38
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions adminSiteServer/apiRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1145,14 +1145,19 @@ deleteRouteWithRWTransaction(
}
)

postRouteWithRWTransaction(apiRouter, "/multi-dim", async (req, res, trx) => {
const { slug, config: rawConfig } = JSON.parse(req.body) as {
slug: string
config: MultiDimDataPageConfigRaw
putRouteWithRWTransaction(
apiRouter,
"/multi-dim/:slug",
async (req, res, trx) => {
const { slug } = req.params
if (!isValidSlug(slug)) {
throw new JsonError(`Invalid multi-dim slug ${slug}`)
}
const rawConfig = req.body as MultiDimDataPageConfigRaw
const id = await createMultiDimConfig(trx, slug, rawConfig)
return { success: true, id }
}
const id = await createMultiDimConfig(trx, slug, rawConfig)
return { success: true, id }
})
)

getRouteWithROTransaction(apiRouter, "/users.json", async (req, res, trx) => ({
users: await trx
Expand Down

0 comments on commit 51cca38

Please sign in to comment.