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