Commit dbe0f774 authored by Abinaya Sudhir's avatar Abinaya Sudhir

successful addcorpus view

parent 87f2e795
...@@ -36,9 +36,8 @@ type State = ...@@ -36,9 +36,8 @@ type State =
newtype Response = Response newtype Response = Response
{ {
count_count :: Int count :: Int
, count_message :: Maybe String , name :: String
, count_name :: String
} }
initialState :: State initialState :: State
...@@ -109,8 +108,8 @@ fn1 :: Response -> ReactElement ...@@ -109,8 +108,8 @@ fn1 :: Response -> ReactElement
fn1 (Response o) = fn1 (Response o) =
li [className "list-group-item justify-content-between"] li [className "list-group-item justify-content-between"]
[ [
span [] [text $ fromMaybe "" o.count_message] span [] [text o.name]
, span [className "badge badge-default badge-pill"] [ text $ show o.count_count] , span [className "badge badge-default badge-pill"] [ text $ show o.count]
] ]
...@@ -152,7 +151,9 @@ getDatabaseDetails reqBody = do ...@@ -152,7 +151,9 @@ getDatabaseDetails reqBody = do
} }
case affResp of case affResp of
Left err -> do Left err -> do
liftAff $ log $ "error" <> show err
pure $ Left $ show err pure $ Left $ show err
Right a -> do Right a -> do
liftAff $ log $ "POST method Completed" liftAff $ log $ "POST method Completed"
liftAff $ log $ "GET /api response: " <> show a.response liftAff $ log $ "GET /api response: " <> show a.response
...@@ -160,11 +161,9 @@ getDatabaseDetails reqBody = do ...@@ -160,11 +161,9 @@ getDatabaseDetails reqBody = do
pure res pure res
instance decodeJsonresponse :: DecodeJson Response where instance decodeJsonresponse :: DecodeJson Response where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
count_count <- obj .? "count_count" count <- obj .? "count"
count_message <- obj .? "count_message" name <- obj .? "name"
count_name <- obj .? "count_name" pure $ Response {count,name }
pure $ Response {count_count,count_message,count_name }
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