Use dynamic route segments with different names by appending index.

This commit is contained in:
Dillon Kearns 2022-01-17 11:46:40 -08:00
parent de3a740165
commit c27377c8f7

View File

@ -303,13 +303,13 @@ function apiPatternToRedirectPattern(pathPattern) {
return (
"/" +
pathPattern
.map((segment) => {
.map((segment, index) => {
switch (segment.kind) {
case "literal": {
return segment.value;
}
case "dynamic": {
return ":dynamic"; // TODO need to assign different names for each dynamic segment?
return `:dynamic${index}`; // TODO need to assign different names for each dynamic segment?
}
default: {
throw "Unhandled segment: " + JSON.stringify(segment);