feat: handle redirects when searchparams are missing in steps

This commit is contained in:
Simon Emanuelsson
2024-10-11 10:46:12 +02:00
parent 5ed940e01f
commit f69c1c4cbf
6 changed files with 101 additions and 5 deletions

View File

@@ -346,4 +346,4 @@
"{amount} {currency}": "{amount} {currency}",
"{difference}{amount} {currency}": "{difference}{amount} {currency}",
"{width} cm × {length} cm": "{width} cm × {length} cm"
}
}

View File

@@ -346,4 +346,4 @@
"{amount} {currency}": "{amount} {currency}",
"{difference}{amount} {currency}": "{difference}{amount} {currency}",
"{width} cm × {length} cm": "{width} cm × {length} cm"
}
}

View File

@@ -347,4 +347,4 @@
"{amount} {currency}": "{amount} {currency}",
"{difference}{amount} {currency}": "{difference}{amount} {currency}",
"{width} cm × {length} cm": "{width} cm × {length} cm"
}
}

View File

@@ -343,4 +343,4 @@
"{amount} {currency}": "{amount} {currency}",
"{difference}{amount} {currency}": "{difference}{amount} {currency}",
"{width} cm × {length} cm": "{width} cm × {length} cm"
}
}

View File

@@ -344,4 +344,4 @@
"{amount} {currency}": "{amount} {currency}",
"{difference}{amount} {currency}": "{difference}{amount} {currency}",
"{width} cm × {length} cm": "{width} cm × {length} cm"
}
}

View File

@@ -69,6 +69,102 @@ const nextConfig = {
return config
},
// https://nextjs.org/docs/app/api-reference/next-config-js/redirects#header-cookie-and-query-matching
redirects() {
const bedTypeQuery = {
key: "bedType",
type: "query",
value: undefined,
}
const breakfastQuery = {
key: "breakfast",
type: "query",
value: undefined,
}
return [
// {
// ----------------------------------------
// Add all required params that should be
// added from Select Room
// ----------------------------------------
// source: "/:lang/hotelreservation/:path",
// destination: "/:lang",
// missing: [
// {
// key: "hotelId",
// type: "query",
// value: undefined,
// },
// ],
// permanent: false,
// },
{
source: "/:lang/hotelreservation/breakfast",
destination: "/:lang/hotelreservation/select-bed",
missing: [bedTypeQuery],
permanent: false,
},
{
source: "/:lang/hotelreservation/details",
destination: "/:lang/hotelreservation/select-bed",
missing: [bedTypeQuery],
permanent: false,
},
{
source: "/:lang/hotelreservation/details",
destination: "/:lang/hotelreservation/breakfast",
missing: [breakfastQuery],
permanent: false,
},
{
source: "/:lang/hotelreservation/payment",
destination: "/:lang/hotelreservation/select-bed",
missing: [bedTypeQuery],
permanent: false,
},
{
source: "/:lang/hotelreservation/payment",
destination: "/:lang/hotelreservation/breakfast",
missing: [breakfastQuery],
permanent: false,
},
{
source: "/:lang/hotelreservation/payment",
destination: "/:lang/hotelreservation/details",
missing: [
{
key: "countryCode",
type: "query",
value: undefined,
},
{
key: "email",
type: "query",
value: undefined,
},
{
key: "firstname",
type: "query",
value: undefined,
},
{
key: "lastname",
type: "query",
value: undefined,
},
{
key: "phoneNumber",
type: "query",
value: undefined,
},
],
permanent: false,
},
]
},
rewrites() {
return {
beforeFiles: [