Commit 4aeb7376 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[graphql] some cleanup in Contact.purs

parent 123756dd
...@@ -154,20 +154,17 @@ itemEditingCpt :: R.Component ItemProps ...@@ -154,20 +154,17 @@ itemEditingCpt :: R.Component ItemProps
itemEditingCpt = here.component "itemNotEditing" cpt where itemEditingCpt = here.component "itemNotEditing" cpt where
cpt { defaultVal, isEditing, lens, onUpdateUserInfo, userInfo, valueBox } _ = do cpt { defaultVal, isEditing, lens, onUpdateUserInfo, userInfo, valueBox } _ = do
valueBox' <- T.useLive T.unequal valueBox valueBox' <- T.useLive T.unequal valueBox
pure $ H.div { className: "input-group col-sm-6" } pure $ H.div { className: "input-group col-sm-6" }
[ inputWithEnter [ inputWithEnter
{ autoFocus: true { autoFocus: true
, className: "form-control" , className: "form-control"
, defaultValue: valueBox' , defaultValue: valueBox'
--, defaultValue: R.readRef valueRef
, onBlur: \v -> T.write_ v valueBox , onBlur: \v -> T.write_ v valueBox
--, onBlur: R.setRef valueRef
, onEnter: click , onEnter: click
, onValueChanged: \v -> do , onValueChanged: \v -> do
here.log2 "[itemEditingCpt] value Changed: " v here.log2 "[itemEditingCpt] value Changed: " v
T.write_ v valueBox T.write_ v valueBox
--, onValueChanged: R.setRef valueRef
, placeholder: defaultVal , placeholder: defaultVal
, type: "text" } , type: "text" }
, H.div { className: "btn input-group-append", on: { click } } , H.div { className: "btn input-group-append", on: { click } }
...@@ -177,7 +174,6 @@ itemEditingCpt = here.component "itemNotEditing" cpt where ...@@ -177,7 +174,6 @@ itemEditingCpt = here.component "itemNotEditing" cpt where
cLens = L.cloneLens lens cLens = L.cloneLens lens
click _ = do click _ = do
T.write_ false isEditing T.write_ false isEditing
--let newUserInfo = (L.over cLens (\_ -> R.readRef valueRef) userInfo) :: UserInfo
value <- T.read valueBox value <- T.read valueBox
here.log2 "[itemEditing] value" value here.log2 "[itemEditing] value" value
let newUserInfo = (L.set cLens value userInfo) :: UserInfo let newUserInfo = (L.set cLens value userInfo) :: UserInfo
...@@ -203,8 +199,6 @@ saveContactHyperdata session id = put session (Routes.NodeAPI Node (Just id) "") ...@@ -203,8 +199,6 @@ saveContactHyperdata session id = put session (Routes.NodeAPI Node (Just id) "")
saveUserInfo :: Session -> Int -> UserInfo -> Aff (Either RESTError Int) saveUserInfo :: Session -> Int -> UserInfo -> Aff (Either RESTError Int)
saveUserInfo session id ui = do saveUserInfo session id ui = do
-- TODO GraphQL
-- pure $ Left $ CustomError "TODO implement graphql for saveUserInfo"
client <- liftEffect $ getClient session client <- liftEffect $ getClient session
res <- mutationOpts res <- mutationOpts
(\m -> m) (\m -> m)
...@@ -221,8 +215,7 @@ saveUserInfo session id ui = do ...@@ -221,8 +215,7 @@ saveUserInfo session id ui = do
, ui_cwRole: ga ui.ui_cwRole , ui_cwRole: ga ui.ui_cwRole
, ui_cwTouchPhone: ga ui.ui_cwTouchPhone , ui_cwTouchPhone: ga ui.ui_cwTouchPhone
, ui_cwTouchMail: ga ui.ui_cwTouchMail } } , ui_cwTouchMail: ga ui.ui_cwTouchMail } }
liftEffect $ here.log2 "[saveUserInfo] res" res pure $ Right res.update_user_info
pure $ Right 0
where where
ga Nothing = ArgL IgnoreArg ga Nothing = ArgL IgnoreArg
ga (Just val) = ArgR val ga (Just val) = ArgR val
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment