You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
745 B

module Navigation exposing (Route(..), linkClicked, routeParser)
import Browser
import Browser.Navigation as Nav
import Url
import Url.Parser exposing ((</>), Parser, map, oneOf, s, top)
linkClicked : Browser.UrlRequest -> Nav.Key -> model -> ( model, Cmd msg )
linkClicked urlRequest key model =
case urlRequest of
Browser.Internal url ->
( model, Nav.pushUrl key (Url.toString url) )
Browser.External href ->
( model, Nav.load href )
type Route
= Home
| Poker String
routeParser : Parser (Route -> Route) Route
routeParser =
oneOf
[ map Home top
, map Poker (s "poker" </> Url.Parser.string)
--, map ShowTicket (s "tickets" </> Url.Parser.int)
]