🔧 Rewiring for the new uncompression endpoint

This commit is contained in:
Rishi Ghan
2022-04-26 14:51:28 -07:00
parent 52daf4781b
commit ee5ba474ee
3 changed files with 33 additions and 42 deletions

View File

@@ -246,42 +246,40 @@ export const fetchComicVineMatches =
});
};
export const extractComicArchive =
(path: string, options: IExtractionOptions) => async (dispatch) => {
const comicBookPages: string[] = [];
dispatch({
type: IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_CALL_IN_PROGRESS,
});
const extractedComicBookArchive = await axios({
method: "POST",
url: `${LIBRARY_SERVICE_BASE_URI}/unrarArchive`,
headers: {
"Content-Type": "application/json; charset=utf-8",
},
data: {
options,
filePath: path,
},
});
map(extractedComicBookArchive.data, (page) => {
const pathItems = page.filePath.split("/");
const folderName = pathItems[pathItems.length - 2];
export const extractComicArchive = (path: string) => async (dispatch) => {
const comicBookPages: string[] = [];
dispatch({
type: IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_CALL_IN_PROGRESS,
});
const extractedComicBookArchive = await axios({
method: "POST",
url: `${LIBRARY_SERVICE_BASE_URI}/uncompressFullArchive`,
headers: {
"Content-Type": "application/json; charset=utf-8",
},
data: {
filePath: path,
},
});
map(extractedComicBookArchive.data, (page) => {
const pathItems = page.filePath.split("/");
const folderName = pathItems[pathItems.length - 2];
const imagePath = encodeURI(
`${LIBRARY_SERVICE_HOST}/userdata/expanded/` +
const imagePath = encodeURI(
`${LIBRARY_SERVICE_HOST}/userdata/expanded/` +
folderName +
`/` +
page.name +
page.extension,
);
comicBookPages.push(imagePath);
});
console.log(comicBookPages);
dispatch({
type: IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_SUCCESS,
extractedComicBookArchive: comicBookPages,
});
};
);
comicBookPages.push(imagePath);
});
console.log(comicBookPages);
dispatch({
type: IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_SUCCESS,
extractedComicBookArchive: comicBookPages,
});
};
export const searchIssue = (query, options) => async (dispatch) => {
dispatch({

View File

@@ -40,7 +40,7 @@ type ComicDetailProps = {};
* )
*/
export const ComicDetail = ({ }: ComicDetailProps): ReactElement => {
export const ComicDetail = ({}: ComicDetailProps): ReactElement => {
const [page, setPage] = useState(1);
const [active, setActive] = useState(1);
const [visible, setVisible] = useState(false);
@@ -237,8 +237,8 @@ export const ComicDetail = ({ }: ComicDetailProps): ReactElement => {
{/* Downloads tab and count badge */}
<a>
{id === 5 &&
!isNil(comicBookDetailData) &&
!isEmpty(comicBookDetailData) ? (
!isNil(comicBookDetailData) &&
!isEmpty(comicBookDetailData) ? (
<span className="download-icon-labels">
<i className="fa-solid fa-download"></i>
<span className="tag downloads-count is-info is-light">

View File

@@ -23,14 +23,7 @@ export const ArchiveOperations = (props): ReactElement => {
const dispatch = useDispatch();
const unpackComicArchive = useCallback(() => {
dispatch(
extractComicArchive(data.rawFileDetails.filePath, {
extractTarget: "book",
targetExtractionFolder:
"./userdata/expanded/" + data.rawFileDetails.name,
extractionMode: "all",
}),
);
dispatch(extractComicArchive(data.rawFileDetails.filePath));
}, [dispatch, data]);
// sliding panel config