Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Type.Odds10.AppRoute
- exposing
- ( AppRoute(NotInitialized, NotFound, Home,BetSlip,Football)
- , FootballRoute(Search,Match)
- , toRoute
- , toPath
- , doRedirects
- )
- import RouteParser exposing (..)
- -- Redirections
- doRedirects : AppRoute -> AppRoute
- doRedirects route =
- case route of
- Home -> Football Search
- _ -> route
- -- GLobal Routes
- toRoute location =
- match matchers location
- type AppRoute
- = NotInitialized
- | NotFound
- | Home
- | BetSlip
- | Football FootballRoute
- matchers =
- [ static Home ""
- , static Home "/"
- , static BetSlip "/bet_slip"
- , static BetSlip "/bet_slip/"
- ] ++ (mapMatchers Football footballMatchers)
- toPath : AppRoute -> String
- toPath route =
- case route of
- NotInitialized -> "/404"
- NotFound -> "/404"
- Home -> ""
- BetSlip -> "/bet_slip"
- Football football_route -> footballToPath football_route
- -- Football Routes
- type FootballRoute
- = Search
- | Match Int
- footballMatchers =
- [ static Search "/football"
- , static Search "/football/"
- , dyn1 Match "/football/match/" int ""
- ]
- footballToPath : FootballRoute -> String
- footballToPath route =
- case route of
- Search -> "/football"
- Match id -> "/football/match/" ++ (toString id)
Add Comment
Please, Sign In to add comment