From 346ae8dcfaeb75fd21075e662c623d4cb4507312 Mon Sep 17 00:00:00 2001 From: rtrembecky Date: Sun, 24 Nov 2024 00:17:44 +0100 Subject: [PATCH] flatpages will use forward slashes around id --- src/pages/strom/[page].tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/strom/[page].tsx b/src/pages/strom/[page].tsx index 5feec938..6f479898 100644 --- a/src/pages/strom/[page].tsx +++ b/src/pages/strom/[page].tsx @@ -28,7 +28,7 @@ export const seminarBasedGetServerSideProps = if (query?.page && typeof query.page === 'string') { const requestedUrl = query.page const {data} = await axios.get( - `${process.env.NEXT_PUBLIC_BE_PROTOCOL}://${process.env.NEXT_PUBLIC_BE_HOSTNAME}:${process.env.NEXT_PUBLIC_BE_PORT}/base/flat-page/by-url/${requestedUrl}`, + `${process.env.NEXT_PUBLIC_BE_PROTOCOL}://${process.env.NEXT_PUBLIC_BE_HOSTNAME}:${process.env.NEXT_PUBLIC_BE_PORT}/base/flat-page/by-url/${encodeURIComponent(`/${requestedUrl}/`)}`, ) // ked stranka neexistuje, vrati sa `content: ""`. teraz renderujeme stranku len ked je content neprazdny a server rovno vrati redirect. // druha moznost by bola nechat prazdny content handlovat clienta - napriklad zobrazit custom error, ale nechat usera na neplatnej stranke.