Commit 51577839 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[READ] cosmetics.

parent 8091879e
...@@ -143,7 +143,8 @@ performAction (ChangePageSize ps) _ _ = void (cotransform (\state -> changePage ...@@ -143,7 +143,8 @@ performAction (ChangePageSize ps) _ _ = void (cotransform (\state -> changePage
performAction (ChangePage p) _ _ = void (cotransform (\(TableData td) -> TableData $ td { currentPage = p} )) performAction (ChangePage p) _ _ = void (cotransform (\(TableData td) -> TableData $ td { currentPage = p} ))
performAction LoadData _ _ = void do performAction LoadData _ _ = void do
res <- lift $ loadData res <- lift $ loadData "http://localhost:8008/corpus/452132/facet/documents/table"
--res <- lift $ loadData "http://localhost:8009/corpus/1/facet/documents/table"
case res of case res of
Left err -> cotransform $ \(state) -> state Left err -> cotransform $ \(state) -> state
Right resData -> do Right resData -> do
...@@ -379,13 +380,11 @@ showRow {row : (Corpus c), delete} = ...@@ -379,13 +380,11 @@ showRow {row : (Corpus c), delete} =
true -> "fas " true -> "fas "
false -> "far " false -> "far "
loadData :: forall eff. String -> Aff ( console :: CONSOLE, ajax :: AJAX| eff) (Either String (Array Response))
loadData url = do
loadData :: forall eff. Aff ( console :: CONSOLE, ajax :: AJAX| eff) (Either String (Array Response))
loadData = do
affResp <- liftAff $ attempt $ affjax defaultRequest affResp <- liftAff $ attempt $ affjax defaultRequest
{ method = Left GET { method = Left GET
, url = "http://localhost:8009/corpus/1/facet/documents/table" , url = url
, headers = [ ContentType applicationJSON , headers = [ ContentType applicationJSON
, Accept applicationJSON , Accept applicationJSON
-- , RequestHeader "Authorization" $ "Bearer " <> token -- , RequestHeader "Authorization" $ "Bearer " <> token
......
...@@ -28,7 +28,6 @@ data Routes ...@@ -28,7 +28,6 @@ data Routes
| PGraphExplorer | PGraphExplorer
| NGramsTable | NGramsTable
instance showRoutes :: Show Routes where instance showRoutes :: Show Routes where
show Home = "Home" show Home = "Home"
show Login = "Login" show Login = "Login"
...@@ -45,35 +44,22 @@ instance showRoutes :: Show Routes where ...@@ -45,35 +44,22 @@ instance showRoutes :: Show Routes where
int :: Match Int int :: Match Int
int = floor <$> num int = floor <$> num
routing :: Match Routes routing :: Match Routes
routing = routing =
loginRoute Login <$ route "login"
<|> tabview <|> Tabview <$ route "tabview"
<|> documentView <|> AnnotationDocumentView <$> (route "documentView" *> int)
<|> userPageRoute <|> UserPage <$ route "userPage"
<|> searchRoute <|> SearchView <$ route "search"
<|> docviewRoute <|> DocView <$ route "docView"
<|> addcorpusRoute <|> AddCorpus <$ route "addCorpus"
<|> corpusAnalysis <|> CorpusAnalysis <$ route "corpus"
<|> graphExplorer <|> PGraphExplorer <$ route "graphExplorer"
<|> ngramsTable <|> NGramsTable <$ route "ngrams"
<|> home <|> Home <$ lit ""
where where
ngramsTable = NGramsTable <$ route "ngrams"
tabview = Tabview <$ route "tabview"
documentView = AnnotationDocumentView <$> (route "documentView" *> int)
userPageRoute = UserPage <$ route "userPage"
searchRoute = SearchView <$ route "search"
docviewRoute = DocView <$ route "docView"
addcorpusRoute = AddCorpus <$ route "addCorpus"
loginRoute = Login <$ route "login"
corpusAnalysis = CorpusAnalysis <$ route "corpus"
graphExplorer = PGraphExplorer <$ route "graphExplorer"
home = Home <$ lit ""
route str = lit "" *> lit str route str = lit "" *> lit str
routeHandler :: forall e. ( Maybe Routes -> Routes -> Eff routeHandler :: forall e. ( Maybe Routes -> Routes -> Eff
( dom :: DOM ( dom :: DOM
, console :: CONSOLE , console :: CONSOLE
......
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