Skip to content

Commit

Permalink
fix(admin): fix admin grapher preview throwing
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber committed Sep 4, 2024
1 parent db6e133 commit acf6144
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions adminSiteServer/adminRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,14 @@ getPlainRouteNonIdempotentWithRWTransaction(
adminRouter,
"/grapher/:slug",
async (req, res, trx) => {
const entity = await getChartConfigBySlug(trx, req.params.slug).catch(
const chart = await getChartConfigBySlug(trx, req.params.slug).catch(
() => undefined
)
if (entity) {
if (chart) {
const previewDataPageOrGrapherPage =
await renderPreviewDataPageOrGrapherPage(entity.config, trx)
await renderPreviewDataPageOrGrapherPage(chart.config, trx)
res.send(previewDataPageOrGrapherPage)
return
}

const mdd = await getMultiDimDataPageBySlug(trx, req.params.slug, {
Expand All @@ -369,6 +370,7 @@ getPlainRouteNonIdempotentWithRWTransaction(
mdd.config
)
res.send(renderedPage)
return
}

throw new JsonError("No such chart", 404)
Expand Down

0 comments on commit acf6144

Please sign in to comment.