fix a bug with redirects

This commit is contained in:
Ryan Haskell-Glatz 2021-03-15 21:22:05 -05:00
parent 896145a2d9
commit 245a4020fa

View File

@ -3,6 +3,7 @@ module Main exposing (main)
import Browser import Browser
import Browser.Navigation as Nav exposing (Key) import Browser.Navigation as Nav exposing (Key)
import Effect import Effect
import Gen.Model
import Gen.Pages as Pages import Gen.Pages as Pages
import Gen.Route as Route import Gen.Route as Route
import Request import Request
@ -93,10 +94,22 @@ update msg model =
let let
( shared, sharedCmd ) = ( shared, sharedCmd ) =
Shared.update (Request.create () model.url model.key) sharedMsg model.shared Shared.update (Request.create () model.url model.key) sharedMsg model.shared
( page, effect ) =
Pages.init (Route.fromUrl model.url) shared model.url model.key
in in
( { model | shared = shared } if page == Gen.Model.Redirecting_ then
, Cmd.map Shared sharedCmd ( { model | shared = shared, page = page }
) , Cmd.batch
[ Cmd.map Shared sharedCmd
, Effect.toCmd ( Shared, Page ) effect
]
)
else
( { model | shared = shared }
, Cmd.map Shared sharedCmd
)
Page pageMsg -> Page pageMsg ->
let let