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

[graphql] some endpoint work [does not compile]

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