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
6d2a6fc3
Commit
6d2a6fc3
authored
Oct 08, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[graphql] some styling fixes for graphql
parent
8a4bda91
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
13 deletions
+36
-13
GraphQL.purs
src/Gargantext/Components/GraphQL.purs
+36
-13
No files found.
src/Gargantext/Components/GraphQL.purs
View file @
6d2a6fc3
...
@@ -2,6 +2,7 @@ module Gargantext.Components.GraphQL where
...
@@ -2,6 +2,7 @@ module Gargantext.Components.GraphQL where
import Gargantext.Prelude
import Gargantext.Prelude
import Affjax.RequestBody (RequestBody(..))
import Data.Argonaut.Decode (class DecodeJson)
import Data.Argonaut.Decode (class DecodeJson)
import Data.Maybe (Maybe(..), maybe)
import Data.Maybe (Maybe(..), maybe)
import Effect (Effect)
import Effect (Effect)
...
@@ -33,13 +34,27 @@ graphQLTestCpt = here.component "graphQLTest" cpt where
...
@@ -33,13 +34,27 @@ graphQLTestCpt = here.component "graphQLTest" cpt where
launchAff_ $ do
launchAff_ $ do
{ user } <-
{ user } <-
queryGql "get user"
queryGql "get user"
{ user: { name: "x" } =>> { name, user_id } }
{ user: { user_id: 1 } =>> { userLight_id
, userLight_username
, userLight_password
, userLight_email } }
liftEffect $ here.log2 "[graphQLTest] user" user
liftEffect $ here.log2 "[graphQLTest] user" user
liftEffect $ T.write_ (Just user) userBox
liftEffect $ T.write_ (Just user) userBox
pure $ H.div { className: "col-12 d-flex justify-content-center" }
pure $ R2.row
[ H.h1 {} [ H.text "graph ql test" ]
--[ H.div { className: "col-12 d-flex justify-content-center" }
, H.p {} [ H.text $ showMUser user' ]
[ R2.col 12
[ R2.row
[ R2.col 12
[ H.h1 {} [ H.text "graph ql test" ]
]
]
, R2.row
[ R2.col 12
[ H.p {} [ H.text $ showMUser user' ]
]
]
]
]
]
queryGql ::
queryGql ::
...
@@ -51,19 +66,27 @@ queryGql = query_ "http://localhost:8008/gql" (Proxy :: Proxy Schema)
...
@@ -51,19 +66,27 @@ queryGql = query_ "http://localhost:8008/gql" (Proxy :: Proxy Schema)
-- Schema
-- Schema
type Schema
type Schema
= { user :: {
name :: String
} ==> User
= { user :: {
user_id :: Int
} ==> User
}
}
type User
type User
= { name :: String
= { userLight_id :: Int
, user_id :: Int
, userLight_username :: String
, userLight_password :: String
, userLight_email :: String
}
}
showUser { name, user_id } = name <> " :: " <> show user_id
showUser { userLight_id
, userLight_username
, userLight_password
, userLight_email } = "[" <> show userLight_id <> "] " <> userLight_username <> " :: " <> userLight_email
showMUser u = maybe "" showUser u
showMUser u = maybe "" showUser u
-- Symbols
-- Symbols
name :: Proxy "name"
userLight_id :: Proxy "userLight_id"
name = Proxy
userLight_id = Proxy
userLight_username :: Proxy "userLight_username"
user_id :: Proxy "user_id"
userLight_username = Proxy
user_id = Proxy
userLight_password :: Proxy "userLight_password"
userLight_password = Proxy
userLight_email :: Proxy "userLight_email"
userLight_email = Proxy
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