mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-24 15:12:01 +03:00
Handle index special case in new routeToPath.
This commit is contained in:
parent
da4482f0f2
commit
4673565123
@ -539,7 +539,9 @@ routeToPath maybeRoute =
|
||||
.map((param) => {
|
||||
switch (param.kind) {
|
||||
case "static": {
|
||||
return `[ "${camelToKebab(param.name)}" ]`;
|
||||
return param.name === "Index"
|
||||
? `[]`
|
||||
: `[ "${camelToKebab(param.name)}" ]`;
|
||||
}
|
||||
case "optional": {
|
||||
return `Router.maybeToList params.${param.name}`;
|
||||
|
@ -95,7 +95,7 @@ ensureLeadingSlash path =
|
||||
|
||||
stripTrailingSlash : String -> String
|
||||
stripTrailingSlash path =
|
||||
if path |> String.endsWith "/" then
|
||||
if (path |> String.endsWith "/") && (String.length path > 1) then
|
||||
String.dropRight 1 path
|
||||
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user