mi/sina/src/Route.elm

34 lines
875 B
Elm
Raw Normal View History

2020-11-16 16:26:03 +00:00
module Route exposing (Route(..), routeParser)
2020-11-16 02:52:38 +00:00
2020-11-16 16:26:03 +00:00
import Url.Parser exposing ((</>), Parser, map, oneOf, s, string)
2020-11-16 02:52:38 +00:00
type Route
= Index
| Login
2020-11-16 15:10:57 +00:00
| NotFound
2020-11-16 16:26:03 +00:00
| SwitchLog
2020-11-16 02:52:38 +00:00
| SwitchID String
| MakeSwitch
2020-11-16 16:26:03 +00:00
| WebMentionLog
2020-11-16 02:52:38 +00:00
| WebMentionID String
| Packages
| OCPackages
| OCPackage String
2020-11-16 02:52:38 +00:00
routeParser : Parser (Route -> a) a
routeParser =
oneOf
[ map Index <| s ""
, map Login <| s "login"
, map SwitchLog <| s "switches"
, map SwitchID <| s "switches" </> string
, map MakeSwitch <| s "switches" </> s "log"
, map WebMentionLog <| s "webmentions"
, map WebMentionID <| s "webmentions" </> string
, map Packages <| s "packages"
, map OCPackages <| s "packages" </> s "orangeconnex"
, map OCPackage <| s "packages" </> s "orangeconnex" </> string
2020-11-16 02:52:38 +00:00
]