mirror of
https://github.com/ryannhg/elm-spa.git
synced 2024-11-25 23:43:02 +03:00
update to handle html redirect
This commit is contained in:
parent
30caa30883
commit
cef01332ec
@ -84,15 +84,28 @@ update msg model =
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
GotMarkdown (Ok markdown) ->
|
||||
( { model | markdown = Success markdown }
|
||||
, Cmd.none
|
||||
)
|
||||
GotMarkdown response ->
|
||||
let
|
||||
success markdown =
|
||||
( { model | markdown = Success markdown }
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
GotMarkdown (Err _) ->
|
||||
( { model | markdown = Failure "Couldn't find that section of the guide..." }
|
||||
, Cmd.none
|
||||
)
|
||||
failure =
|
||||
( { model | markdown = Failure "Couldn't find that section of the guide..." }
|
||||
, Cmd.none
|
||||
)
|
||||
in
|
||||
case response of
|
||||
Ok markdown ->
|
||||
if String.startsWith "<!DOCTYPE" markdown then
|
||||
failure
|
||||
|
||||
else
|
||||
success markdown
|
||||
|
||||
Err _ ->
|
||||
failure
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user