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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
aab569f8
Commit
aab569f8
authored
Mar 02, 2018
by
Abinaya Sudhir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Api code
parent
e1475f43
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
1 deletion
+55
-1
AddCorpusview.purs
src/AddCorpusview.purs
+55
-1
No files found.
src/AddCorpusview.purs
View file @
aab569f8
...
...
@@ -9,6 +9,7 @@ import Control.Monad.Eff.Class (liftEff)
import Control.Monad.Eff.Console (CONSOLE)
import DOM (DOM)
import DOM.HTML (window)
import DOM.HTML.Location (host)
import DOM.HTML.Window (localStorage)
import DOM.WebStorage.Storage (getItem, setItem)
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson, jsonEmptyObject, (.?), (:=), (~>))
...
...
@@ -19,7 +20,7 @@ import Data.MediaType.Common (applicationJSON)
import Network.HTTP.Affjax (AJAX, affjax, defaultRequest)
import Network.HTTP.RequestHeader (RequestHeader(..))
import Prelude hiding (div)
import React.DOM (a, button, div, form, h2, h3, h4, i, input, label,
p, span, text
)
import React.DOM (a, button, div, form, h2, h3, h4, i, input, label,
li, p, span, text, ul
)
import React.DOM.Props (_id, _type, className, href, maxLength, name, onClick, onInput, placeholder, target, value)
import Routing.Hash.Aff (setHash)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
...
...
@@ -76,9 +77,62 @@ addcorpusviewSpec = simpleSpec performAction render
, div [className "col-md-9"]
[
h3 [] [text "Corpusview"]
, ul [className "list-group"]
[
li [className "list-group-item justify-content-between"]
[
span [className "badge badge-default badge-pill"] []
]
]
]
]
]
]
]
getDatabaseDetais = do
let token = ""
-- liftEff $ log $ "calling update Age "
affResp <- liftAff $ attempt $ affjax defaultRequest
{ method = Left GET
, url ="http://unstable.gargantext.org/api/auth/token"
, headers = [ ContentType applicationJSON
, Accept applicationJSON
, RequestHeader "Authorization" $ "Bearer " <> token
]
}
case affResp of
Left err -> do
pure $ Left $ show err
Right a -> do
liftAff $ log $ "POST method Completed"
liftAff $ log $ "GET /api response: " <> show a.response
let res = decodeJson a.response
pure res
-- updateProfileAge :: forall eff. State -> UpdateAgeReq -> Aff (console::CONSOLE,ajax :: AJAX | eff) (Either String UpdateProfileUserProfile)
-- updateProfileAge state reqBody = do
-- let token = fromMaybe "" $ (\(State s) -> s.token) state
-- liftEff $ log $ "calling update Age " <> show reqBody
-- affResp <- liftAff $ attempt $ affjax defaultRequest
-- { method = Left PUT
-- , url = host <> "api/users/update_profile_fields"
-- , headers = [ ContentType applicationJSON
-- , Accept applicationJSON
-- , RequestHeader "Authorization" $ "Bearer " <> token
-- ]
-- , content = Just $ encodeJson reqBody
-- }
-- case affResp of
-- Left err -> do
-- pure $ Left $ show err
-- Right a -> do
-- liftEff $ log $ "POST method Completed"
-- liftEff $ log $ "GET /api response: " <> show a.response
-- let res = decodeJson a.response
-- pure res
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