[ngrams] Auto sync request handling should return an Either
As a user, when I'm navigating on a Node Document, I can modify and add ngrams. Each modifications are now saved automatically. When saving has been made, the spinner stops accordingly. Unfortunately, when an error occur (eg. Backend issue), no visual difference is shown. I want a UI feedback underlying to me that an error occurred.
Coding steps
- in the
Gargantext.Components.NgramsTable.Core
module, this type should have aresult
property returning an Either instead of aUnit
type AutoSyncOutput =
-- @XXX: cannot use an Either here due to the mecanism of `syncPatches` only
-- returning an `Aff Unit`
-- ( result :: T.Box (Maybe (Either RESTError Unit))
( result :: T.Box (Maybe Unit)
, onPending :: T.Box Boolean
)
-
in the same module, the
syncPatches
variable should log onLeft::Either
the error -
in the same module, the
syncPatches
variable should return anEffect (Either RESTError Unit)
instead of aEffect Unit
, so that later process could handle differently the request response (ie. late UI changes)