mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 17:47:03 +00:00
ui: Unknown routes redirect to Home
This commit is contained in:
@@ -245,17 +245,6 @@ changeRouteTo route model =
|
|||||||
{ model | layout = Layout.reset model.layout }
|
{ model | layout = Layout.reset model.layout }
|
||||||
in
|
in
|
||||||
case route of
|
case route of
|
||||||
Route.Unknown path ->
|
|
||||||
let
|
|
||||||
flash =
|
|
||||||
{ title = "Unknown route requested"
|
|
||||||
, table = [ ( "Path", path ) ]
|
|
||||||
}
|
|
||||||
in
|
|
||||||
( applyToModelSession (Session.showFlash flash) newModel
|
|
||||||
, Cmd.none
|
|
||||||
)
|
|
||||||
|
|
||||||
Route.Home ->
|
Route.Home ->
|
||||||
Home.init session
|
Home.init session
|
||||||
|> updateWith Home HomeMsg newModel
|
|> updateWith Home HomeMsg newModel
|
||||||
@@ -276,7 +265,7 @@ changeRouteTo route model =
|
|||||||
else
|
else
|
||||||
let
|
let
|
||||||
flash =
|
flash =
|
||||||
{ title = "Unknown route requested"
|
{ title = "Disabled route requested"
|
||||||
, table = [ ( "Error", "Monitor disabled by configuration." ) ]
|
, table = [ ( "Error", "Monitor disabled by configuration." ) ]
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
@@ -288,6 +277,17 @@ changeRouteTo route model =
|
|||||||
Status.init session
|
Status.init session
|
||||||
|> updateWith Status StatusMsg newModel
|
|> updateWith Status StatusMsg newModel
|
||||||
|
|
||||||
|
Route.Unknown path ->
|
||||||
|
-- Unknown routes display Home with an error flash.
|
||||||
|
let
|
||||||
|
flash =
|
||||||
|
{ title = "Unknown route requested"
|
||||||
|
, table = [ ( "Path", path ) ]
|
||||||
|
}
|
||||||
|
in
|
||||||
|
Home.init (Session.showFlash flash session)
|
||||||
|
|> updateWith Home HomeMsg newModel
|
||||||
|
|
||||||
|
|
||||||
getSession : Model -> Session
|
getSession : Model -> Session
|
||||||
getSession model =
|
getSession model =
|
||||||
|
|||||||
Reference in New Issue
Block a user