mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-28 23:12:22 +03:00
Use the right logic for generating RouteParams in elm-pages add.
This commit is contained in:
parent
62f1ac56f8
commit
246a9d8a06
@ -142,7 +142,22 @@ function routeVariantDefinition(name) {
|
||||
* @param {string[]} name
|
||||
*/
|
||||
function paramsRecord(name) {
|
||||
return `{ ${routeParams(name).map((param) => `${param} : String`)} }`;
|
||||
return `{ ${parseRouteParams(name).map((param) => {
|
||||
switch (param.kind) {
|
||||
case "dynamic": {
|
||||
return `${param.name} : String`;
|
||||
}
|
||||
case "optional": {
|
||||
return `${param.name} : Maybe String`;
|
||||
}
|
||||
case "required-splat": {
|
||||
return `splat : ( String , List String )`;
|
||||
}
|
||||
case "optional-splat": {
|
||||
return `splat : List String`;
|
||||
}
|
||||
}
|
||||
})} }`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user