⬇️ Fetched qBittorrent settings
This commit is contained in:
@@ -4,20 +4,26 @@ export const torrentsApi = emptySplitApi.injectEndpoints({
|
||||
endpoints: (builder) => ({
|
||||
connectToQBittorrentClient: builder.query({
|
||||
queryFn: async (_arg, _queryApi, _extraOptions, fetchWithBQ) => {
|
||||
const qBittorrentHostInfo = await fetchWithBQ(
|
||||
"localhost:3000/api/settings/getAllSettings",
|
||||
);
|
||||
await fetchWithBQ({
|
||||
url: "localhost:3060/api/qbittorrent/connect",
|
||||
method: "POST",
|
||||
data: qBittorrentHostInfo,
|
||||
});
|
||||
console.log(qBittorrentHostInfo);
|
||||
return {
|
||||
url: "",
|
||||
method: "GET",
|
||||
data: qBittorrentHostInfo,
|
||||
};
|
||||
try {
|
||||
const {
|
||||
data: { bittorrent },
|
||||
} = await fetchWithBQ("localhost:3000/api/settings/getAllSettings");
|
||||
await fetchWithBQ({
|
||||
url: "localhost:3060/api/qbittorrent/connect",
|
||||
method: "POST",
|
||||
body: bittorrent?.client?.host,
|
||||
});
|
||||
const { data } = await fetchWithBQ({
|
||||
url: "localhost:3060/api/qbittorrent/getClientInfo",
|
||||
method: "GET",
|
||||
});
|
||||
|
||||
return {
|
||||
data: { bittorrent, qbittorrentClientInfo: data },
|
||||
};
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
}),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user