Commit 6d2a6fc3 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[graphql] some styling fixes for graphql

parent 8a4bda91
...@@ -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.div { className: "col-12 d-flex justify-content-center" }
[ R2.col 12
[ R2.row
[ R2.col 12
[ H.h1 {} [ H.text "graph ql test" ] [ H.h1 {} [ H.text "graph ql test" ]
, H.p {} [ H.text $ showMUser user' ] ]
]
, 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
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