fix: redirect root my pages to overview page
This commit is contained in:
@@ -18,10 +18,6 @@ export default async function MyPages({
|
|||||||
throw new Error("Bad URI")
|
throw new Error("Bad URI")
|
||||||
}
|
}
|
||||||
|
|
||||||
const myPagesRoot = myPages[params.lang].replace(`/${params.lang}`, "")
|
|
||||||
if (searchParams.uri === myPagesRoot) {
|
|
||||||
redirect(overview[params.lang])
|
|
||||||
}
|
|
||||||
const accountPage = await serverClient().contentstack.accountPage.get({
|
const accountPage = await serverClient().contentstack.accountPage.get({
|
||||||
url: searchParams.uri,
|
url: searchParams.uri,
|
||||||
lang: params.lang,
|
lang: params.lang,
|
||||||
|
|||||||
@@ -72,6 +72,35 @@ const nextConfig = {
|
|||||||
|
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
|
redirects() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
source: myPages.da,
|
||||||
|
destination: overview.da,
|
||||||
|
permanent: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
source: myPages.de,
|
||||||
|
destination: overview.de,
|
||||||
|
permanent: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
source: myPages.fi,
|
||||||
|
destination: overview.fi,
|
||||||
|
permanent: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
source: myPages.no,
|
||||||
|
destination: overview.no,
|
||||||
|
permanent: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
source: myPages.sv,
|
||||||
|
destination: overview.sv,
|
||||||
|
permanent: false,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
rewrites() {
|
rewrites() {
|
||||||
return {
|
return {
|
||||||
beforeFiles: [
|
beforeFiles: [
|
||||||
@@ -102,12 +131,6 @@ const nextConfig = {
|
|||||||
{ source: login.no, destination: "/no/login" },
|
{ source: login.no, destination: "/no/login" },
|
||||||
{ source: login.sv, destination: "/sv/login" },
|
{ source: login.sv, destination: "/sv/login" },
|
||||||
|
|
||||||
{ source: myPages.da, destination: "/da/my-pages/overview" },
|
|
||||||
{ source: myPages.de, destination: "/de/my-pages/overview" },
|
|
||||||
{ source: myPages.fi, destination: "/fi/my-pages/overview" },
|
|
||||||
{ source: myPages.no, destination: "/no/my-pages/overview" },
|
|
||||||
{ source: myPages.sv, destination: "/sv/my-pages/overview" },
|
|
||||||
|
|
||||||
{ source: overview.da, destination: "/da/my-pages/overview" },
|
{ source: overview.da, destination: "/da/my-pages/overview" },
|
||||||
{ source: overview.de, destination: "/de/my-pages/overview" },
|
{ source: overview.de, destination: "/de/my-pages/overview" },
|
||||||
{ source: overview.fi, destination: "/fi/my-pages/overview" },
|
{ source: overview.fi, destination: "/fi/my-pages/overview" },
|
||||||
|
|||||||
Reference in New Issue
Block a user