⬇️ Fetched qBittorrent settings
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
import React, { ReactElement, useCallback, useEffect } from "react";
|
||||
import { useAppDispatch, useAppSelector } from "../../../hooks/store";
|
||||
import { getQBitTorrentClientInfo } from "../../../actions/settings.actions";
|
||||
import React, { ReactElement, useCallback } from "react";
|
||||
import { saveSettings } from "../../../actions/settings.actions";
|
||||
import { ConnectionForm } from "../../shared/ConnectionForm/ConnectionForm";
|
||||
import { useGetAllSettingsQuery } from "../../../services/settings.api";
|
||||
import { isUndefined } from "lodash";
|
||||
import { useConnectToQBittorrentClientQuery } from "../../../services/torrents.api";
|
||||
|
||||
export const QbittorrentConnectionForm = (): ReactElement => {
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const { data, isLoading } = useConnectToQBittorrentClientQuery({});
|
||||
const onSubmit = useCallback(async (values) => {
|
||||
try {
|
||||
dispatch(saveSettings(values, "bittorrent"));
|
||||
@@ -18,7 +13,18 @@ export const QbittorrentConnectionForm = (): ReactElement => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
return <></>;
|
||||
return (
|
||||
<>
|
||||
{!isLoading && (
|
||||
<ConnectionForm
|
||||
initialData={data?.bittorrent.client.host}
|
||||
submitHandler={onSubmit}
|
||||
formHeading={"Qbittorrent Configuration"}
|
||||
/>
|
||||
)}
|
||||
<pre>{JSON.stringify(data?.qbittorrentClientInfo, null, 2)}</pre>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default QbittorrentConnectionForm;
|
||||
|
||||
Reference in New Issue
Block a user