From 5d89c729aed9df6dd96e3880a91897ae5dfabbca Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sun, 12 Jul 2020 22:47:03 -0700 Subject: hero: put app routes behind auth --- Hero/App.hs | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'Hero/App.hs') diff --git a/Hero/App.hs b/Hero/App.hs index 56289f8..6f7a8c4 100644 --- a/Hero/App.hs +++ b/Hero/App.hs @@ -295,29 +295,32 @@ data Action | DumpModel deriving (Show, Eq) -type ClientRoutes = - Home - :<|> ComicCover +type AppRoutes = + ComicCover :<|> ComicReaderSpread :<|> ComicReaderFull :<|> ComicVideo - :<|> Login :<|> Discover :<|> ChooseExperience handlers = - home - :<|> comicCover + comicCover :<|> comicReader :<|> comicReader :<|> comicReader - :<|> login :<|> discover :<|> comicReader -routes :: Proxy ClientRoutes +routes :: Proxy AppRoutes routes = Proxy +type PubRoutes = + Home + :<|> Login + +pubRoutes :: Proxy PubRoutes +pubRoutes = Proxy + -- * pages -- -- TODO: consider making a typeclass, something like: @@ -330,6 +333,8 @@ routes = Proxy -- link :: Api.URI -- * home +-- +-- this is the unauthenticated page that you see when you first visit type Home = View Action @@ -337,12 +342,14 @@ type Home = homeProxy :: Proxy Home homeProxy = Proxy +homeLink :: Api.URI +homeLink = linkURI $ Api.safeLink front homeProxy + where + front = Proxy :: Proxy Home + home :: Model -> View Action home = login -homeLink :: Api.URI -homeLink = linkURI $ Api.safeLink routes homeProxy - -- * login data LoginForm = LoginForm {loginEmail :: String, loginPass :: String} @@ -359,7 +366,7 @@ loginProxy :: Proxy Login loginProxy = Proxy loginLink :: Api.URI -loginLink = linkURI $ Api.safeLink routes loginProxy +loginLink = linkURI $ Api.safeLink pubRoutes loginProxy login :: Model -> View Action login _ = @@ -807,11 +814,12 @@ appmenu :: View Action appmenu = aside_ [id_ "appmenu"] $ btn "hero-logo.svg"]], div_ [id_ "app-head-right"] -- cgit v1.2.3