mirror of
https://github.com/ryan-haskell/elm-spa.git
synced 2024-11-22 11:31:58 +03:00
fix a bug with redirects
This commit is contained in:
parent
896145a2d9
commit
245a4020fa
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user