Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
cd39004e
Commit
cd39004e
authored
Nov 04, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[graphql] first draft for mutations
parent
00098c86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
GraphQL.purs
src/Gargantext/Components/GraphQL.purs
+5
-1
Contact.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
+10
-3
No files found.
src/Gargantext/Components/GraphQL.purs
View file @
cd39004e
...
...
@@ -3,6 +3,7 @@ module Gargantext.Components.GraphQL where
import Data.Argonaut.Decode (JsonDecodeError)
import Data.Bifunctor (lmap)
import Data.List.Types (NonEmptyList)
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Foreign (unsafeToForeign, ForeignError)
...
...
@@ -39,6 +40,9 @@ gqlQuery = queryWithDecoder (unsafeToForeign >>> JSON.read >>> lmap toJsonError
toJsonError :: NonEmptyList ForeignError -> JsonDecodeError
toJsonError = unsafeCoerce -- map ForeignErrors to JsonDecodeError as you wish
getClient :: Effect (Client UrqlClient Schema Void Void)
getClient = createClient { headers: [], url: "http://localhost:8008/gql" }
queryGql ::
forall query returns.
GqlQuery Schema query returns =>
...
...
@@ -46,7 +50,7 @@ queryGql ::
String -> query -> Aff returns
queryGql name q = do
--query client name q
client <- liftEffect
$ createClient { headers: [], url: "http://localhost:8008/gql" }
client <- liftEffect
getClient
gqlQuery (client :: Client UrqlClient Schema Void Void) name q
--query_ "http://localhost:8008/gql" (Proxy :: Proxy Schema)
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
View file @
cd39004e
...
...
@@ -20,7 +20,7 @@ import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.GraphQL (queryGql)
import Gargantext.Components.GraphQL (
getClient,
queryGql)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Tabs as Tabs
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (Contact'(..), ContactData', ContactTouch(..), ContactWhere(..), ContactWho(..), HyperdataContact(..), HyperdataUser(..), _city, _country, _firstName, _labTeamDeptsJoinComma, _lastName, _mail, _office, _organizationJoinComma, _ouFirst, _phone, _role, _shared, _touch, _who, defaultContactTouch, defaultContactWhere, defaultContactWho, defaultHyperdataContact, defaultHyperdataUser)
...
...
@@ -33,7 +33,8 @@ import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Types (NodeType(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import GraphQL.Client.Args (type (==>), (=>>))
import GraphQL.Client.Args (type (==>), (=>>), onlyArgs)
import GraphQL.Client.Query (mutationOpts)
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
...
...
@@ -223,7 +224,13 @@ saveContactHyperdata session id = put session (Routes.NodeAPI Node (Just id) "")
saveUserInfo :: Session -> Int -> UserInfo -> Aff (Either RESTError Int)
saveUserInfo session id ui = do
-- TODO GraphQL
pure $ Left $ CustomError "TODO implement graphql for saveUserInfo"
--pure $ Left $ CustomError "TODO implement graphql for saveUserInfo"
client <- liftEffect $ getClient
mutationOpts
(\m -> m)
client
"update user_info"
{ update_user_info: onlyArgs { ui_id: id } }
type AnnuaireLayoutProps = ( annuaireId :: Int, session :: Session | ReloadProps )
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment