From 70425023c79436add3fcf339aeb53b306e38fdf6 Mon Sep 17 00:00:00 2001 From: Mudada <mael.nicolas@imt.fr> Date: Mon, 25 Jun 2018 12:45:57 +0200 Subject: [PATCH] rewrite the let and rename `id` --- src/Gargantext/Users/API.purs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Gargantext/Users/API.purs b/src/Gargantext/Users/API.purs index 052755ddb..7a23055a0 100644 --- a/src/Gargantext/Users/API.purs +++ b/src/Gargantext/Users/API.purs @@ -26,12 +26,11 @@ performAction :: forall eff props. PerformAction ( console :: CONSOLE | eff ) State props Action performAction NoOp _ _ = void do modifyState id -performAction (FetchUser id) _ _ = void do - value <- lift $ getUser id - let user = case value of - (Right user) -> Just user - _ -> Nothing - _ <- pure <<< log $ "Fetching user..." - pure $ modifyState \state -> set _user user state +performAction (FetchUser userId) _ _ = void do + value <- lift $ getUser userId + _ <- case value of + (Right user) -> modifyState \state -> set _user (Just user) state + _ -> modifyState id + pure <<< log $ "Fetching user..." performAction _ _ _ = void do modifyState id -- 2.21.0