Commit 3744eee3 authored by Abinaya Sudhir's avatar Abinaya Sudhir

solving 405 method not allowed options

parent c0a13ee7
...@@ -20,6 +20,7 @@ import Data.MediaType.Common (applicationJSON) ...@@ -20,6 +20,7 @@ import Data.MediaType.Common (applicationJSON)
import Network.HTTP.Affjax (AJAX, affjax, defaultRequest) import Network.HTTP.Affjax (AJAX, affjax, defaultRequest)
import Network.HTTP.RequestHeader (RequestHeader(..)) import Network.HTTP.RequestHeader (RequestHeader(..))
import Prelude hiding (div) import Prelude hiding (div)
import React (ReactElement)
import React.DOM (a, button, div, form, h2, h3, h4, i, input, label, li, p, span, text, ul) 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 React.DOM.Props (_id, _type, className, href, maxLength, name, onClick, onInput, placeholder, target, value)
import Routing.Hash.Aff (setHash) import Routing.Hash.Aff (setHash)
...@@ -95,13 +96,7 @@ addcorpusviewSpec = simpleSpec performAction render ...@@ -95,13 +96,7 @@ addcorpusviewSpec = simpleSpec performAction render
, div [className "col-md-9"] , div [className "col-md-9"]
[ [
h3 [] [text "Corpusview"] h3 [] [text "Corpusview"]
, ul [className "list-group"] , ul [className "list-group"] $ map fn1 state.response
[
li [className "list-group-item justify-content-between"]
[
span [className "badge badge-default badge-pill"] []
]
]
] ]
] ]
...@@ -110,6 +105,13 @@ addcorpusviewSpec = simpleSpec performAction render ...@@ -110,6 +105,13 @@ addcorpusviewSpec = simpleSpec performAction render
] ]
fn1 :: Response -> ReactElement
fn1 (Response o) =
li [className "list-group-item justify-content-between"]
[
span [className "badge badge-default badge-pill"] [ text $ show o.count_count]
]
getDatabaseDetails :: forall eff. Aff (console::CONSOLE,ajax :: AJAX | eff) (Either String (Array Response)) getDatabaseDetails :: forall eff. Aff (console::CONSOLE,ajax :: AJAX | eff) (Either String (Array Response))
getDatabaseDetails = do getDatabaseDetails = do
let token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1MTk5OTg1ODMsInVzZXJfaWQiOjUsImVtYWlsIjoiYWxleGFuZHJlLmRlbGFub2VAaXNjcGlmLmZyIiwidXNlcm5hbWUiOiJkZXZlbG9wZXIifQ.Os-3wuFNSmRIxCZi98oFNBu2zqGc0McO-dgDayozHJg" let token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1MTk5OTg1ODMsInVzZXJfaWQiOjUsImVtYWlsIjoiYWxleGFuZHJlLmRlbGFub2VAaXNjcGlmLmZyIiwidXNlcm5hbWUiOiJkZXZlbG9wZXIifQ.Os-3wuFNSmRIxCZi98oFNBu2zqGc0McO-dgDayozHJg"
......
...@@ -69,7 +69,7 @@ performAction Login _ (State state) = void do ...@@ -69,7 +69,7 @@ performAction Login _ (State state) = void do
lift $ log $ show e lift $ log $ show e
modifyState \(State s) -> State $ s { errorMessage = e} modifyState \(State s) -> State $ s { errorMessage = e}
Right r@(LoginRes response) -> do Right r@(LoginRes response) -> do
lift $ setHash "/" lift $ setHash "/addCorpus"
modifyState \(State s) -> State $ s {response = r, errorMessage = ""} modifyState \(State s) -> State $ s {response = r, errorMessage = ""}
...@@ -176,7 +176,7 @@ loginReq encodeData = ...@@ -176,7 +176,7 @@ loginReq encodeData =
let let
setting = setting =
defaultRequest defaultRequest
{ url = "http://unstable.gargantext.org/api/auth/token" { url = "https://dev.gargantext.org/api/auth/token"
, method = Left POST , method = Left POST
, headers = , headers =
[ ContentType applicationJSON [ ContentType applicationJSON
......
...@@ -33,7 +33,7 @@ routing = ...@@ -33,7 +33,7 @@ routing =
<|> addcorpusRoute <|> addcorpusRoute
<|> home <|> home
where where
addcorpusRoute = AddCorpus <$ route "AddCorpus" addcorpusRoute = AddCorpus <$ route "addCorpus"
loginRoute = Login <$ route "login" loginRoute = Login <$ route "login"
home = Home <$ lit "" home = Home <$ lit ""
route str = lit "" *> lit str route str = lit "" *> lit str
......
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