🔧 Updated AirDC++ socket connection code app-wide

This commit is contained in:
2023-01-20 21:55:41 -08:00
parent 3102b489c8
commit 1d8dd3ca3e
4 changed files with 6 additions and 22 deletions

View File

@@ -64,11 +64,7 @@ export const search =
async (dispatch) => {
try {
if (!ADCPPSocket.isConnected()) {
await ADCPPSocket.connect(
credentials.username,
credentials.password,
true,
);
await ADCPPSocket();
}
const instance: SearchInstance = await ADCPPSocket.post("search");
dispatch({
@@ -154,11 +150,7 @@ export const downloadAirDCPPItem =
async (dispatch) => {
try {
if (!ADCPPSocket.isConnected()) {
await ADCPPSocket.connect(
`${credentials.username}`,
`${credentials.password}`,
true,
);
await ADCPPSocket.connect();
}
let bundleDBImportResult = {};
const downloadResult = await ADCPPSocket.post(
@@ -203,11 +195,7 @@ export const getBundlesForComic =
async (dispatch) => {
try {
if (!ADCPPSocket.isConnected()) {
await ADCPPSocket.connect(
`${credentials.username}`,
`${credentials.password}`,
true,
);
await ADCPPSocket.connect();
}
const comicObject = await axios({
method: "POST",
@@ -241,11 +229,7 @@ export const getTransfers =
(ADCPPSocket: any, credentials: any) => async (dispatch) => {
try {
if (!ADCPPSocket.isConnected()) {
await ADCPPSocket.connect(
`${credentials.username}`,
`${credentials.password}`,
true,
);
await ADCPPSocket.connect();
}
const bundles = await ADCPPSocket.get("queue/bundles/1/85", {});
if (!isNil(bundles)) {