diff --git a/src/Gargantext/Components/DocsTable.purs b/src/Gargantext/Components/DocsTable.purs index ff930ac86a4720734591448e7b17425dec27bb2f..790e7ac77a891a06a2a10185980dd1e0041c37e2 100644 --- a/src/Gargantext/Components/DocsTable.purs +++ b/src/Gargantext/Components/DocsTable.purs @@ -368,8 +368,7 @@ type PageParams = getPageHash :: Session -> PageParams -> Aff String getPageHash session { corpusId, listId, nodeId, query, tabType } = do - let p = NodeAPI Node (Just nodeId) $ "table/hash" <> "?tabType=" <> (showTabType' tabType) - (get session p) :: Aff String + (get session $ tableHashRoute nodeId tabType) :: Aff String convOrderBy (Just (T.ASC (T.ColumnName "Date"))) = Just DateAsc @@ -417,7 +416,7 @@ pageLayoutCpt = R.hooksComponent "G.C.DocsTable.pageLayout" cpt where mkRequest :: PageParams -> GUC.Request mkRequest p@{ listId, nodeId, tabType } = - GUC.makeGetRequest session $ NodeAPI Node (Just nodeId) $ "table" <> "?tabType=" <> (showTabType' tabType) <> "&list=" <> (show listId) + GUC.makeGetRequest session $ tableRoute nodeId tabType listId handleResponse :: HashedResponse (TableResult Response) -> Tuple Int (Array DocumentsView) handleResponse (HashedResponse { hash, value: res }) = ret where @@ -543,13 +542,15 @@ instance encodeJsonSQuery :: EncodeJson SearchQuery where ~> jsonEmptyObject - -searchResults :: SearchQuery -> Aff Int -searchResults squery = pure 42 -- TODO post "http://localhost:8008/count" unit - documentsRoute :: Int -> SessionRoute documentsRoute nodeId = NodeAPI Node (Just nodeId) "documents" +tableRoute :: Int -> TabType -> Int -> SessionRoute +tableRoute nodeId tabType listId = NodeAPI Node (Just nodeId) $ "table" <> "?tabType=" <> (showTabType' tabType) <> "&list=" <> (show listId) + +tableHashRoute :: Int -> TabType -> SessionRoute +tableHashRoute nodeId tabType = NodeAPI Node (Just nodeId) $ "table/hash" <> "?tabType=" <> (showTabType' tabType) + deleteAllDocuments :: Session -> Int -> Aff (Array Int) deleteAllDocuments session = delete session <<< documentsRoute diff --git a/src/Gargantext/Utils/CacheAPI.purs b/src/Gargantext/Utils/CacheAPI.purs index b1e30ce2f0dfc1d724c0b23f698980f563f055c3..c7dc646625e4e93134198cac891aa981cac5008a 100644 --- a/src/Gargantext/Utils/CacheAPI.purs +++ b/src/Gargantext/Utils/CacheAPI.purs @@ -78,10 +78,10 @@ cached cache req = do mRes <- match cache req case mRes of Just res -> do - liftEffect $ log2 "[cached] cache hit" req + -- liftEffect $ log2 "[cached] cache hit" req pure res Nothing -> do - liftEffect $ log2 "[cached] cache miss" req + -- liftEffect $ log2 "[cached] cache miss" req _ <- add cache req mResFresh <- match cache req case mResFresh of @@ -91,8 +91,8 @@ cached cache req = do cachedJson :: forall a. DecodeJson a => Cache -> Request -> Aff a cachedJson cache req = do res <- cached cache req - liftEffect $ do - log2 "[cachedJson] res" res + -- liftEffect $ do + -- log2 "[cachedJson] res" res j <- M.json res case decodeJson (F.unsafeFromForeign j) of