Add long polling live updates.

This commit is contained in:
2018-12-09 00:35:07 -08:00
parent 0ceb1413ce
commit 70cf5273e9
3 changed files with 110 additions and 7 deletions

View File

@@ -71,9 +71,13 @@ updateLoginResponse model r = case r of
Err e -> (model, Cmd.none)
updateSyncResponse : Model -> Result Http.Error SyncResponse -> (Model, Cmd Msg)
updateSyncResponse model r = let sync = model.sync in case r of
Ok sr -> ({ model | sync = mergeSyncResponse model.sync sr }, Cmd.none)
_ -> (model, Cmd.none)
updateSyncResponse model r =
let
cmd = sync model.sync.nextBatch model.apiUrl <| Maybe.withDefault "" model.token
in
case r of
Ok sr -> ({ model | sync = mergeSyncResponse model.sync sr }, cmd)
_ -> (model, cmd)
subscriptions : Model -> Sub Msg
subscriptions m = Sub.none