mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 10:58:26 +00:00
Encode ws messages as JSON
This commit is contained in:
@ -19,6 +19,7 @@ import Api.Model.VersionInfo exposing (VersionInfo)
|
||||
import Browser exposing (UrlRequest)
|
||||
import Browser.Navigation exposing (Key)
|
||||
import Data.Flags exposing (Flags)
|
||||
import Data.ServerEvent exposing (ServerEvent)
|
||||
import Data.UiSettings exposing (StoredUiSettings, UiSettings)
|
||||
import Data.UiTheme exposing (UiTheme)
|
||||
import Http
|
||||
@ -192,7 +193,7 @@ type Msg
|
||||
| SetLanguage UiLanguage
|
||||
| ClientSettingsSaveResp UiSettings (Result Http.Error BasicResult)
|
||||
| ReceiveBrowserSettings StoredUiSettings
|
||||
| ReceiveWsMessage String
|
||||
| ReceiveWsMessage (Result String ServerEvent)
|
||||
| ToggleShowNewItemsArrived
|
||||
|
||||
|
||||
|
@ -310,12 +310,8 @@ updateWithSub msg model =
|
||||
updateUserSettings texts lm model
|
||||
|
||||
ReceiveWsMessage data ->
|
||||
let
|
||||
se =
|
||||
Data.ServerEvent.fromString data
|
||||
in
|
||||
case se of
|
||||
Just ItemProcessed ->
|
||||
case data of
|
||||
Ok ItemProcessed ->
|
||||
let
|
||||
newModel =
|
||||
{ model | showNewItemsArrived = True }
|
||||
@ -327,7 +323,10 @@ updateWithSub msg model =
|
||||
_ ->
|
||||
( newModel, Cmd.none, Sub.none )
|
||||
|
||||
Nothing ->
|
||||
Ok (JobsWaiting n) ->
|
||||
( model, Cmd.none, Sub.none )
|
||||
|
||||
Err err ->
|
||||
( model, Cmd.none, Sub.none )
|
||||
|
||||
ToggleShowNewItemsArrived ->
|
||||
|
Reference in New Issue
Block a user