diff --git a/starsky/starsky/clientapp/src/components/organisms/modal-force-delete/modal-force-delete.tsx b/starsky/starsky/clientapp/src/components/organisms/modal-force-delete/modal-force-delete.tsx index 940c898ff2..5f6b861eee 100644 --- a/starsky/starsky/clientapp/src/components/organisms/modal-force-delete/modal-force-delete.tsx +++ b/starsky/starsky/clientapp/src/components/organisms/modal-force-delete/modal-force-delete.tsx @@ -3,6 +3,7 @@ import { ArchiveAction } from "../../../contexts/archive-context"; import useGlobalSettings from "../../../hooks/use-global-settings"; import useLocation from "../../../hooks/use-location"; import { IArchiveProps } from "../../../interfaces/IArchiveProps"; +import FetchGet from "../../../shared/fetch-get"; import FetchPost from "../../../shared/fetch-post"; import { Language } from "../../../shared/language"; import { ClearSearchCache } from "../../../shared/search/clear-search-cache"; @@ -76,6 +77,13 @@ const ModalForceDelete: React.FunctionComponent = ({ ).then((result) => { if (result.statusCode === 200 || result.statusCode === 404) { dispatch({ type: "remove", toRemoveFileList: toUndoTrashList }); + + if (state.pageNumber === 1) { + const url = new UrlQuery().UrlSearchTrashApi(state.pageNumber); + FetchGet(url).then((result) => { + console.log(result); + }); + } } ClearSearchCache(history.location.search); diff --git a/starsky/starsky/clientapp/src/hooks/use-fetch.ts b/starsky/starsky/clientapp/src/hooks/use-fetch.ts index 1418e2e9d2..790cc0c349 100644 --- a/starsky/starsky/clientapp/src/hooks/use-fetch.ts +++ b/starsky/starsky/clientapp/src/hooks/use-fetch.ts @@ -26,6 +26,14 @@ const useFetch = (url: string, method: "get" | "post"): IConnectionDefault => { return data; }; +/** + * From useFetch internal + * @param url - where to look for + * @param method - GET, POST + * @param mounted - is the component mounted + * @param abortController - cancel request + * @param setData - where to set the date when received + */ export const fetchContent = async ( url: string, method: "get" | "post", diff --git a/starsky/starsky/clientapp/src/hooks/use-filelist.ts b/starsky/starsky/clientapp/src/hooks/use-filelist.ts index b4479c2e6f..d4f0700563 100644 --- a/starsky/starsky/clientapp/src/hooks/use-filelist.ts +++ b/starsky/starsky/clientapp/src/hooks/use-filelist.ts @@ -40,6 +40,12 @@ const useFileList = ( const [parent, setParent] = useState("/"); const location = new UrlQuery().UrlQueryServerApi(locationSearch); + /** + * fetchContent inside useFileList + * @param locationLocal url + * @param abortController how to abort + * @returns promise with no content + */ const fetchContent = async ( locationLocal: string, abortController: AbortController diff --git a/starsky/starsky/clientapp/src/hooks/use-searchlist.ts b/starsky/starsky/clientapp/src/hooks/use-searchlist.ts index 70583c4658..706fcec4b2 100644 --- a/starsky/starsky/clientapp/src/hooks/use-searchlist.ts +++ b/starsky/starsky/clientapp/src/hooks/use-searchlist.ts @@ -44,6 +44,13 @@ const setErrorPageType = ( return false; }; +/** + * Search Query + * @param query - where to search for + * @param pageNumber - pagenumber starts with 1 + * @param resetPageTypeBeforeLoading - add loading icon on startup + * @returns - promise with void + */ const useSearchList = ( query: string | undefined, pageNumber: number | undefined, @@ -58,6 +65,12 @@ const useSearchList = ( ? new UrlQuery().UrlQuerySearchApi(query, pageNumber) : undefined; + /** + * From SearchList to fetch trash and search content + * @param locationScoped - url + * @param abortController - how to cancel + * @returns emthy promise + */ const fetchContent = async ( locationScoped: string | undefined, abortController: AbortController