🔧 Refactoring the way bundles are saved
This commit is contained in:
@@ -148,30 +148,7 @@ export const downloadAirDCPPItem =
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!isNil(downloadResult)) {
|
if (!isNil(downloadResult)) {
|
||||||
bundleDBImportResult = await axios({
|
|
||||||
method: "POST",
|
|
||||||
url: `${LIBRARY_SERVICE_BASE_URI}/applyAirDCPPDownloadMetadata`,
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=utf-8",
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
resultId,
|
|
||||||
comicObjectId,
|
|
||||||
searchInstanceId: instanceId,
|
|
||||||
bundleId,
|
|
||||||
directoryIds,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
dispatch({
|
|
||||||
type: AIRDCPP_RESULT_DOWNLOAD_INITIATED,
|
|
||||||
downloadResult: downloadResult,
|
|
||||||
bundleDBImportResult,
|
|
||||||
});
|
|
||||||
dispatch({
|
|
||||||
type: IMS_COMIC_BOOK_DB_OBJECT_FETCHED,
|
|
||||||
comicBookDetail: bundleDBImportResult.data,
|
|
||||||
IMS_inProgress: false,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -23,10 +23,12 @@ import {
|
|||||||
import { isEmpty, isUndefined } from "lodash";
|
import { isEmpty, isUndefined } from "lodash";
|
||||||
import { AIRDCPP_DOWNLOAD_PROGRESS_TICK } from "../constants/action-types";
|
import { AIRDCPP_DOWNLOAD_PROGRESS_TICK } from "../constants/action-types";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
|
import axios from "axios";
|
||||||
|
import { LIBRARY_SERVICE_BASE_URI } from "../constants/endpoints";
|
||||||
|
import { useParams } from "react-router";
|
||||||
|
|
||||||
const AirDCPPSocketComponent = (): ReactElement => {
|
const AirDCPPSocketComponent = (): ReactElement => {
|
||||||
const airDCPPConfiguration = useContext(AirDCPPSocketContext);
|
const airDCPPConfiguration = useContext(AirDCPPSocketContext);
|
||||||
console.log(airDCPPConfiguration);
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const foo = async () => {
|
const foo = async () => {
|
||||||
@@ -38,7 +40,36 @@ const AirDCPPSocketComponent = (): ReactElement => {
|
|||||||
await airDCPPConfiguration.airDCPPState.socket.addListener(
|
await airDCPPConfiguration.airDCPPState.socket.addListener(
|
||||||
"queue",
|
"queue",
|
||||||
"queue_bundle_added",
|
"queue_bundle_added",
|
||||||
async (data) => console.log("JEMEN:", data),
|
async (data) => {
|
||||||
|
console.log("JEMEN:", data);
|
||||||
|
const { id, name, size, target, time_added, type } = data;
|
||||||
|
const downloadResultMetadata = await axios({
|
||||||
|
method: "POST",
|
||||||
|
url: `${LIBRARY_SERVICE_BASE_URI}/applyAirDCPPDownloadMetadata`,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json; charset=utf-8",
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
bundleId: id,
|
||||||
|
name,
|
||||||
|
size,
|
||||||
|
target,
|
||||||
|
time_added,
|
||||||
|
type
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// dispatch({
|
||||||
|
// type: AIRDCPP_RESULT_DOWNLOAD_INITIATED,
|
||||||
|
// downloadResult: downloadResult,
|
||||||
|
// bundleDBImportResult,
|
||||||
|
// });
|
||||||
|
// dispatch({
|
||||||
|
// type: IMS_COMIC_BOOK_DB_OBJECT_FETCHED,
|
||||||
|
// comicBookDetail: bundleDBImportResult.data,
|
||||||
|
// IMS_inProgress: false,
|
||||||
|
// });
|
||||||
|
|
||||||
|
}
|
||||||
);
|
);
|
||||||
// download tick listener
|
// download tick listener
|
||||||
await airDCPPConfiguration.airDCPPState.socket.addListener(
|
await airDCPPConfiguration.airDCPPState.socket.addListener(
|
||||||
|
|||||||
@@ -245,6 +245,7 @@ export const AcquisitionPanel = (
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{map(airDCPPSearchResults, ({ result }, idx) => {
|
{map(airDCPPSearchResults, ({ result }, idx) => {
|
||||||
|
console.log(result);
|
||||||
return (
|
return (
|
||||||
<tr
|
<tr
|
||||||
key={idx}
|
key={idx}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ export const TabControls = (props): ReactElement => {
|
|||||||
|
|
||||||
const [active, setActive] = useState(filteredTabs[0].id);
|
const [active, setActive] = useState(filteredTabs[0].id);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log(comicBookDetailData);
|
|
||||||
setActive(filteredTabs[0].id);
|
setActive(filteredTabs[0].id);
|
||||||
}, [comicBookDetailData]);
|
}, [comicBookDetailData]);
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ const Navbar: React.FunctionComponent = (props) => {
|
|||||||
const downloadProgressTick = useSelector(
|
const downloadProgressTick = useSelector(
|
||||||
(state: RootState) => state.airdcpp.downloadProgressData,
|
(state: RootState) => state.airdcpp.downloadProgressData,
|
||||||
);
|
);
|
||||||
console.log(downloadProgressTick);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav className="navbar is-fixed-top">
|
<nav className="navbar is-fixed-top">
|
||||||
|
|||||||
Reference in New Issue
Block a user