diff --git a/apps/infoalloggi/src/pages/annunci.tsx b/apps/infoalloggi/src/pages/annunci.tsx index b1baea7..f5458c6 100644 --- a/apps/infoalloggi/src/pages/annunci.tsx +++ b/apps/infoalloggi/src/pages/annunci.tsx @@ -39,7 +39,6 @@ import { cn, debounce } from "~/lib/utils"; import { useTranslation } from "~/providers/I18nProvider"; import { type AnnunciOptions, - compatibilityPatch, RicercaProvider, type SortTypes, useRicerca, @@ -94,21 +93,9 @@ Annunci.getLayout = (page: React.ReactNode) => { return {page}; }; - - -export const getServerSideProps = (async (ctx) => { +export const getServerSideProps = (async () => { const helper = generateSSGHelper(); const options = await helper.annunci.getAnnunciOptions.fetch(); - const {patched, query} = compatibilityPatch(ctx.query); - if (patched){ - const queryString = new URLSearchParams(query as Record).toString(); - return { - redirect: { - destination: `/annunci?${queryString}`, - permanent: false, - }, - }; - } return { props: { options, diff --git a/apps/infoalloggi/src/providers/RicercaProvider.tsx b/apps/infoalloggi/src/providers/RicercaProvider.tsx index 6355c63..952c3b2 100644 --- a/apps/infoalloggi/src/providers/RicercaProvider.tsx +++ b/apps/infoalloggi/src/providers/RicercaProvider.tsx @@ -7,7 +7,6 @@ import { parseAsStringLiteral, useQueryState, } from "nuqs"; -import type { ParsedUrlQuery } from "querystring"; import { createContext, type FC, @@ -229,31 +228,3 @@ export const RicercaProvider: FC<{ ); }; - -const acceptedParams = ["m", "t", "c", "f", "bmin", "bmax", "s"]; -const patchedParams = { - map: "m", - tipo: "t", - comune: "c", - consegna: "f", - minBudget: "bmin", - maxBudget: "bmax", - sort: "s", -}; -export const compatibilityPatch = (query: ParsedUrlQuery) => { - let patched = false; - for (const key of Object.keys(query)) { - if (!acceptedParams.includes(key)) { - if (Object.keys(patchedParams).includes(key)) { - const mappedKey = patchedParams[key as keyof typeof patchedParams]; - if (mappedKey) { - const value = query[key]; - delete query[key]; - query[mappedKey] = value; - patched = true; - } - } - } - } - return { patched, query }; -};