Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
f1722b30
Commit
f1722b30
authored
Oct 18, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext
into dev
parents
b21a965d
6ce58850
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
REST.purs
src/Gargantext/Config/REST.purs
+11
-9
No files found.
src/Gargantext/Config/REST.purs
View file @
f1722b30
module Gargantext.Config.REST where
module Gargantext.Config.REST where
import Prelude (Unit, bind,
logs,
pure, ($), (<$>), (<<<), (<>))
import Prelude (Unit, bind, pure, ($), (<$>), (<<<), (<>))
import Affjax (defaultRequest, printResponseFormatError, request)
import Affjax (defaultRequest, printResponseFormatError, request)
import Affjax.RequestBody (RequestBody(..), string)
import Affjax.RequestBody (RequestBody(..), string)
import Affjax.RequestHeader (RequestHeader(..))
import Affjax.RequestHeader (RequestHeader(..))
import Affjax.ResponseFormat as ResponseFormat
import Affjax.ResponseFormat as ResponseFormat
import Effect.Class (liftEffect)
import Data.Argonaut (class DecodeJson, decodeJson, class EncodeJson, encodeJson)
import Data.Argonaut (class DecodeJson, decodeJson, class EncodeJson, encodeJson)
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.HTTP.Method (Method(..))
import Data.HTTP.Method (Method(..))
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.MediaType.Common (applicationFormURLEncoded, applicationJSON)
import Data.MediaType.Common (applicationFormURLEncoded, applicationJSON)
import Data.Foldable (foldMap)
import Data.Foldable (foldMap)
import DOM.Simple.Console (log)
import Effect.Aff (Aff, throwError)
import Effect.Aff (Aff, throwError)
import Effect.Exception (error)
import Effect.Exception (error)
...
@@ -35,12 +37,12 @@ send m mtoken url reqbody = do
...
@@ -35,12 +37,12 @@ send m mtoken url reqbody = do
}
}
case affResp.body of
case affResp.body of
Left err -> do
Left err -> do
_ <- l
ogs
$ printResponseFormatError err
_ <- l
iftEffect $ log
$ printResponseFormatError err
throwError $ error $ printResponseFormatError err
throwError $ error $ printResponseFormatError err
Right json -> do
Right json -> do
--_ <- l
ogs $ show
json.status
--_ <- l
iftEffect $ log
json.status
--_ <- l
ogs $ show
json.headers
--_ <- l
iftEffect $ log
json.headers
--_ <- l
ogs $ show
json.body
--_ <- l
iftEffect $ log
json.body
case decodeJson json of
case decodeJson json of
Left err -> throwError $ error $ "decodeJson affResp.body: " <> err
Left err -> throwError $ error $ "decodeJson affResp.body: " <> err
Right b -> pure b
Right b -> pure b
...
@@ -82,12 +84,12 @@ postWwwUrlencoded mtoken url body = do
...
@@ -82,12 +84,12 @@ postWwwUrlencoded mtoken url body = do
}
}
case affResp.body of
case affResp.body of
Left err -> do
Left err -> do
_ <- l
ogs
$ printResponseFormatError err
_ <- l
iftEffect $ log
$ printResponseFormatError err
throwError $ error $ printResponseFormatError err
throwError $ error $ printResponseFormatError err
Right json -> do
Right json -> do
--_ <-
logs $ show
json.status
--_ <-
liftEffect $ log
json.status
--_ <-
logs $ show
json.headers
--_ <-
liftEffect $ log
json.headers
--_ <-
logs $ show
json.body
--_ <-
liftEffect $ log
json.body
case decodeJson json of
case decodeJson json of
Left err -> throwError $ error $ "decodeJson affResp.body: " <> err
Left err -> throwError $ error $ "decodeJson affResp.body: " <> err
Right b -> pure b
Right b -> pure b
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment