EtherCalc.purs 590 Bytes
Newer Older
1 2
module Gargantext.Utils.EtherCalc where

3
import Affjax.Web (Error, Response, defaultRequest, request)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
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