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

[graphql] some endpoint work [does not compile]

parent e004b064
...@@ -11,7 +11,7 @@ import Effect.Class (liftEffect) ...@@ -11,7 +11,7 @@ import Effect.Class (liftEffect)
import Foreign (unsafeToForeign, ForeignError) import Foreign (unsafeToForeign, ForeignError)
import Gargantext.Components.GraphQL.Node (EthercalcCSVDownloadM, Node) import Gargantext.Components.GraphQL.Node (EthercalcCSVDownloadM, Node)
import Gargantext.Components.GraphQL.User (User, UserInfo, UserInfoM) import Gargantext.Components.GraphQL.User (User, UserInfo, UserInfoM)
import Gargantext.Components.GraphQL.Task (AsyncTaskWithType) import Gargantext.Components.GraphQL.Task as GQT
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Sessions (Session(..)) import Gargantext.Sessions (Session(..))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -73,5 +73,5 @@ type Schema ...@@ -73,5 +73,5 @@ type Schema
} }
type Mutation type Mutation
= { ethercalc_csv_download :: EthercalcCSVDownloadM ==> Maybe AsyncTaskWithType = { ethercalc_csv_download :: EthercalcCSVDownloadM ==> Maybe GQT.AsyncTaskWithType
, update_user_info :: UserInfoM ==> Int } , update_user_info :: UserInfoM ==> Int }
module Gargantext.Components.GraphQL.Endpoints where module Gargantext.Components.GraphQL.Endpoints where
import Gargantext.Components.GraphQL.Node
import Gargantext.Components.GraphQL.User
import Gargantext.Prelude
import Data.Array as A import Data.Array as A
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Unit (unit)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Gargantext.Components.GraphQL (getClient, queryGql) import Gargantext.Components.GraphQL (getClient, queryGql)
import Gargantext.Components.GraphQL.Node
import Gargantext.Components.GraphQL.User
import Gargantext.Config.REST (AffRESTError, RESTError(..)) import Gargantext.Config.REST (AffRESTError, RESTError(..))
import Gargantext.Prelude
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (AsyncTaskWithType(..), AsyncTask(..), AsyncTaskType(..), NodeType) import Gargantext.Types (AsyncTaskWithType(..), AsyncTask(..), AsyncTaskType(..), NodeType)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -45,15 +47,17 @@ triggerEthercalcCSVDownload session corpusId nodeId = do ...@@ -45,15 +47,17 @@ triggerEthercalcCSVDownload session corpusId nodeId = do
client client
"trigger ethercalc CSV download" "trigger ethercalc CSV download"
{ ethercalc_csv_download: onlyArgs { corpusId { ethercalc_csv_download: onlyArgs { corpusId
, nodeId } } , nodeId }
pure $ case res.ethercalc_csv_download of pure Nothing
Nothing -> Nothing -- pure $ case res.ethercalc_csv_download of
Just { task: { id, status }, typ } -> -- Nothing -> Nothing
case JSON.readJSON typ of -- Just { task: { id, status }, typ } ->
Left _ -> Nothing -- case JSON.readJSON typ of
Right typ_ -> -- Left _ -> Nothing
case JSON.readJSON status of -- Right typ_ ->
Left _ -> Nothing -- case JSON.readJSON status of
Right status_ -> -- Left _ -> Nothing
Just $ AsyncTaskWithType { task: AsyncTask { id, status: status_ } -- Right status_ ->
, typ: typ_ } -- Just $ AsyncTaskWithType { task: AsyncTask { id, status: status_ }
-- , typ: typ_ }
--
...@@ -4,7 +4,6 @@ import Gargantext.Prelude ...@@ -4,7 +4,6 @@ import Gargantext.Prelude
import GraphQL.Client.Args ((=>>)) import GraphQL.Client.Args ((=>>))
import GraphQL.Client.Variable (Var(..)) import GraphQL.Client.Variable (Var(..))
import Gargantext.Types (NodeType)
type Node type Node
......
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