EtherCalc.purs 589 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
module Gargantext.Utils.EtherCalc where

import Affjax (Error, Response, defaultRequest, request)
import Affjax.ResponseFormat as ResponseFormat
import Data.Either (Either(..))
import Data.HTTP.Method (Method(GET))
import Effect.Aff (Aff)
import Gargantext.Prelude

type Base = String
type NodeId = String

downloadCSV :: Base -> NodeId -> Aff (Either Error (Response String))
downloadCSV base nodeId = do
  let req = defaultRequest
            { url = base <> "/" <> nodeId <> ".csv"
            , responseFormat = ResponseFormat.string
            , method = Left GET }
  request req