mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 10:58:26 +00:00
Save and load dashboards
This commit is contained in:
@ -5,7 +5,10 @@
|
||||
-}
|
||||
|
||||
|
||||
module Util.Result exposing (fold)
|
||||
module Util.Result exposing (combine, fold)
|
||||
|
||||
import Api.Model.BasicResult exposing (BasicResult)
|
||||
import Set
|
||||
|
||||
|
||||
fold : (a -> x) -> (b -> x) -> Result b a -> x
|
||||
@ -16,3 +19,12 @@ fold fa fb rba =
|
||||
|
||||
Err b ->
|
||||
fb b
|
||||
|
||||
|
||||
combine : BasicResult -> BasicResult -> BasicResult
|
||||
combine r1 r2 =
|
||||
BasicResult (r1.success && r2.success)
|
||||
(Set.fromList [ r1.message, r2.message ]
|
||||
|> Set.toList
|
||||
|> String.join ", "
|
||||
)
|
||||
|
Reference in New Issue
Block a user