📕 Added recently imported section to dashboard

This commit is contained in:
2021-06-10 16:18:44 -07:00
parent 1cfe2b215d
commit 62b55a4bd8
9 changed files with 144 additions and 85 deletions

View File

@@ -8,6 +8,7 @@ import { io } from "socket.io-client";
import {
IMS_COMICBOOK_METADATA_FETCHED,
IMS_SOCKET_CONNECTION_CONNECTED,
IMS_RECENT_COMICS_FETCHED,
} from "../constants/action-types";
export async function walkFolder(path: string): Promise<Array<IFolderData>> {
@@ -61,7 +62,6 @@ export const fetchComicBookMetadata = (options) => async (dispatch) => {
extractionOptions,
walkedFolders,
},
opts: { garam: "pasha" },
});
socket.on("comicBookCoverMetadata", (data: IExtractedComicBookCoverFile) => {
@@ -72,3 +72,21 @@ export const fetchComicBookMetadata = (options) => async (dispatch) => {
});
});
};
export const getRecentlyImportedComicBooks = (options) => async (dispatch) => {
const { paginationOptions } = options;
return axios
.request({
url: "http://localhost:3000/api/import/getRecentlyImportedComicBooks",
method: "POST",
data: {
paginationOptions,
},
})
.then((response) => {
dispatch({
type: IMS_RECENT_COMICS_FETCHED,
data: response.data.docs,
});
});
};