Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
Prevent going to login/register manually when already logged-in
Browse files Browse the repository at this point in the history
  • Loading branch information
amilner42 committed Dec 30, 2018
1 parent ae3686b commit f069433
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions frontend/src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,28 @@ changeRouteTo maybeRoute model =
|> updatePageModel Home GotHomeMsg model

Just Route.Login ->
Login.init session
|> updatePageModel Login GotLoginMsg model
-- Don't go to login if they are already signed in.
case Session.viewer <| toSession model of
Nothing ->
Login.init session
|> updatePageModel Login GotLoginMsg model

Just _ ->
( closeMobileNavbar
, Route.replaceUrl (Session.navKey session) Route.Home
)

Just Route.Register ->
Register.init session
|> updatePageModel Register GotRegisterMsg model
-- Don't go to register if they are already signed in.
case Session.viewer <| toSession model of
Nothing ->
Register.init session
|> updatePageModel Register GotRegisterMsg model

Just _ ->
( closeMobileNavbar
, Route.replaceUrl (Session.navKey session) Route.Home
)


update : Msg -> Model -> ( Model, Cmd Msg )
Expand Down

0 comments on commit f069433

Please sign in to comment.