🔧 Created context for AirDC++ socket and refactored all actions

This commit is contained in:
2021-11-18 14:15:48 -08:00
parent 925008bdcb
commit ba6acaac08
5 changed files with 137 additions and 113 deletions

View File

@@ -0,0 +1,15 @@
import React from "react";
import AirDCPPSocket from "../services/DcppSearchService";
import axios from "axios";
import { SETTINGS_SERVICE_BASE_URI } from "../constants/endpoints";
const socketInitConfiguration = await axios({
url: `${SETTINGS_SERVICE_BASE_URI}/getSettings`,
method: "POST",
});
export const airDCPPSocket = new AirDCPPSocket({
hostname: `${socketInitConfiguration.data.directConnect.client.hostname}`,
});
export const SocketContext = React.createContext(airDCPPSocket);