Commit 481dc3ac authored by Alexandre Delanoë's avatar Alexandre Delanoë

[COSMETICS] reading code.

parent 281327fe
......@@ -48,7 +48,7 @@ newtype Response = Response
initialState :: State
initialState =
{
select_database : true
select_database : true
, unselect_database : true
, response : []
}
......@@ -62,7 +62,10 @@ data Action
| GO
performAction :: forall eff props. PerformAction (console :: CONSOLE, ajax :: AJAX,dom::DOM | eff) State props Action
performAction :: forall eff props. PerformAction ( console :: CONSOLE
, ajax :: AJAX
, dom :: DOM
| eff ) State props Action
performAction NoOp _ _ = void do
modifyState id
......@@ -182,7 +185,7 @@ getDatabaseDetails reqBody = do
instance decodeJsonresponse :: DecodeJson Response where
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
count <- obj .? "count"
name <- obj .? "name"
name <- obj .? "name"
pure $ Response {count,name }
......@@ -54,16 +54,15 @@ main = do
-- TODO: When a pagination link is clicked, reload data. Right now it doesn't make sense to reload mock data.
newtype Response = Response
{ cid :: Int
, created :: String
, favorite :: Boolean
{ cid :: Int
, created :: String
, favorite :: Boolean
, ngramCount :: Int
, hyperdata :: Hyperdata
, hyperdata :: Hyperdata
}
newtype Hyperdata = Hyperdata
{
title :: String
{ title :: String
, source :: String
}
......
......@@ -151,18 +151,16 @@ unsafeEventValue e = (unsafeCoerce e).target.value
getDeviseID :: forall eff. Eff (dom :: DOM | eff) (Maybe String)
getDeviseID = do
w <- window
w <- window
ls <- localStorage w
i <- getItem "token" ls
pure $ i
getItem "token" ls
setToken :: forall e . String -> Eff (dom :: DOM | e) Unit
setToken s = do
w <- window
w <- window
ls <- localStorage w
liftEff $ setItem "token" s ls
pure unit
setItem "token" s ls
......@@ -172,7 +170,7 @@ newtype LoginRes = LoginRes
newtype LoginReq = LoginReq
{ username :: String
{ username :: String
, password :: String
}
......@@ -210,7 +208,7 @@ loginReq encodeData =
instance decodeLoginRes :: DecodeJson LoginRes where
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
token <- obj .? "token"
pure $ LoginRes { token}
......
......@@ -286,7 +286,7 @@ sidebarnavSpec = simpleSpec performAction render
, placeholder "Query, URL or FILE (works with Firefox or Chromium browsers)"
, _type "text"
, style { height: "35px"
, width: "450px"
, width : "450px"
-- , color: "white"
-- , background : "#A1C2D8"
}
......@@ -355,15 +355,12 @@ dispatchAction dispatcher _ DocView = do
_ <- dispatcher $ DocViewA $ DV.LoadData
pure unit
dispatchAction dispatcher _ SearchView = do
_ <- dispatcher $ SetRoute $ SearchView
_ <- dispatcher $ SearchA $ S.NoOp
pure unit
dispatchAction dispatcher _ UserPage = do
_ <- dispatcher $ SetRoute $ UserPage
_ <- dispatcher $ UserPageA $ UP.NoOp
pure unit
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