ACCURACY
ACCURACY
TTCTheo's Typesafe Cult
Created by PR on 2/5/2024 in #questions
App Router Issue: Cookies() doesn't run inside a Server Action
@PR try moving the "use server" directive at the top of your file as opposed to having it inline
6 replies
TTCTheo's Typesafe Cult
Created by KOSLA on 1/29/2024 in #questions
Optional Dynamic Routing Problem
Regarding the query parameter approach, and if you insist on having the route structure you gave. Would it be feasible to use rewrites? https://nextjs.org/docs/pages/api-reference/next-config-js/rewrites With a remapping of the form:
[
{
source: '/:affiliateSlug/:locale/products',
destination: '/:locale/products?affiliateSlug=:affiliateSlug',
},
{
source: '/:affiliateSlug/:locale/home',
destination: '/:locale/home?affiliateSlug=:affiliateSlug',
},
]
[
{
source: '/:affiliateSlug/:locale/products',
destination: '/:locale/products?affiliateSlug=:affiliateSlug',
},
{
source: '/:affiliateSlug/:locale/home',
destination: '/:locale/home?affiliateSlug=:affiliateSlug',
},
]
6 replies
TTCTheo's Typesafe Cult
Created by KOSLA on 1/29/2024 in #questions
Optional Dynamic Routing Problem
Ok my reading ability is non existant it seems. You want to have the affiliate slug to be optional. Would it not be better to use query params for the affiliate value if that is the case?
6 replies
TTCTheo's Typesafe Cult
Created by KOSLA on 1/29/2024 in #questions
Optional Dynamic Routing Problem
@muazkassm99 why can't you just do [affiliate]/[lng] as path structure? When you try to access the params in the respective page.tsx/jsx, something like whatever.com/.../affiliate_whatever/en/things will lead to a params value of
{
params: {
lng: "en",
affiliate: "affiliate_whatever",
...
}
}
{
params: {
lng: "en",
affiliate: "affiliate_whatever",
...
}
}
6 replies