mirror of
https://github.com/idanoo/autobrr
synced 2025-07-25 09:49:13 +00:00
parent
e0aaa0bcab
commit
286f2f53f7
20 changed files with 61 additions and 63 deletions
|
@ -1,6 +1,5 @@
|
|||
import { queryClient } from "../../App";
|
||||
import { useRef } from "react";
|
||||
import { useMutation, useQuery } from "react-query";
|
||||
import { useMutation, useQuery, useQueryClient } from "react-query";
|
||||
import { KeyField } from "../../components/fields/text";
|
||||
import { DeleteModal } from "../../components/modals";
|
||||
import APIKeyAddForm from "../../forms/settings/APIKeyAddForm";
|
||||
|
@ -82,6 +81,8 @@ function APIListItem({ apikey }: ApiKeyItemProps) {
|
|||
const cancelModalButtonRef = useRef(null);
|
||||
const [deleteModalIsOpen, toggleDeleteModal] = useToggle(false);
|
||||
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const deleteMutation = useMutation(
|
||||
(key: string) => APIClient.apikeys.delete(key),
|
||||
{
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import { useMutation, useQuery } from "react-query";
|
||||
import { useMutation, useQuery, useQueryClient } from "react-query";
|
||||
import { APIClient } from "../../api/APIClient";
|
||||
import { Checkbox } from "../../components/Checkbox";
|
||||
import { SettingsContext } from "../../utils/Context";
|
||||
import { GithubRelease } from "../../types/Update";
|
||||
import { toast } from "react-hot-toast";
|
||||
import Toast from "../../components/notifications/Toast";
|
||||
import { queryClient } from "../../App";
|
||||
|
||||
interface RowItemProps {
|
||||
label: string;
|
||||
|
@ -89,6 +88,8 @@ function ApplicationSettings() {
|
|||
}
|
||||
);
|
||||
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const checkUpdateMutation = useMutation(
|
||||
() => APIClient.updates.check(),
|
||||
{
|
||||
|
|
|
@ -27,8 +27,6 @@ interface SortConfig {
|
|||
function useSort(items: ListItemProps["clients"][], config?: SortConfig) {
|
||||
const [sortConfig, setSortConfig] = useState(config);
|
||||
|
||||
|
||||
|
||||
const sortedItems = useMemo(() => {
|
||||
if (!sortConfig) {
|
||||
return items;
|
||||
|
@ -80,6 +78,7 @@ function DownloadClientSettingsListItem({ client }: DLSettingsItemProps) {
|
|||
const [updateClientIsOpen, toggleUpdateClient] = useToggle(false);
|
||||
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const mutation = useMutation(
|
||||
(client: DownloadClient) => APIClient.download_clients.update(client),
|
||||
{
|
||||
|
|
|
@ -7,7 +7,6 @@ import { baseUrl, classNames, IsEmptyDate, simplifyDate } from "../../utils";
|
|||
import { Fragment, useRef, useState, useMemo } from "react";
|
||||
import { toast } from "react-hot-toast";
|
||||
import Toast from "../../components/notifications/Toast";
|
||||
import { queryClient } from "../../App";
|
||||
import { DeleteModal } from "../../components/modals";
|
||||
import {
|
||||
ArrowsRightLeftIcon,
|
||||
|
@ -141,6 +140,7 @@ function ListItem({ feed }: ListItemProps) {
|
|||
const [updateFormIsOpen, toggleUpdateForm] = useToggle(false);
|
||||
|
||||
const [enabled, setEnabled] = useState(feed.enabled);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const updateMutation = useMutation(
|
||||
(status: boolean) => APIClient.feeds.toggleEnable(feed.id, status),
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { useMutation, useQuery, useQueryClient } from "react-query";
|
||||
|
||||
import { classNames, IsEmptyDate, simplifyDate } from "../../utils";
|
||||
import { IrcNetworkAddForm, IrcNetworkUpdateForm } from "../../forms";
|
||||
import { useToggle } from "../../hooks/hooks";
|
||||
|
@ -10,7 +9,6 @@ import { Menu, Switch, Transition } from "@headlessui/react";
|
|||
import { Fragment, useRef } from "react";
|
||||
import { DeleteModal } from "../../components/modals";
|
||||
import { useState, useMemo } from "react";
|
||||
|
||||
import { toast } from "react-hot-toast";
|
||||
import Toast from "../../components/notifications/Toast";
|
||||
import {
|
||||
|
@ -30,8 +28,6 @@ interface SortConfig {
|
|||
function useSort(items: ListItemProps["network"][], config?: SortConfig) {
|
||||
const [sortConfig, setSortConfig] = useState(config);
|
||||
|
||||
|
||||
|
||||
const sortedItems = useMemo(() => {
|
||||
if (!sortConfig) {
|
||||
return items;
|
||||
|
@ -79,7 +75,6 @@ function useSort(items: ListItemProps["network"][], config?: SortConfig) {
|
|||
return { items: sortedItems, requestSort, sortConfig, getSortIndicator };
|
||||
}
|
||||
|
||||
|
||||
const IrcSettings = () => {
|
||||
const [expandNetworks, toggleExpand] = useToggle(false);
|
||||
const [addNetworkIsOpen, toggleAddNetwork] = useToggle(false);
|
||||
|
@ -92,7 +87,6 @@ const IrcSettings = () => {
|
|||
|
||||
const sortedNetworks = useSort(data || []);
|
||||
|
||||
|
||||
return (
|
||||
<div className="lg:col-span-9">
|
||||
<IrcNetworkAddForm isOpen={addNetworkIsOpen} toggle={toggleAddNetwork} />
|
||||
|
@ -209,6 +203,7 @@ const ListItem = ({ idx, network, expanded }: ListItemProps) => {
|
|||
const [edit, toggleEdit] = useToggle(false);
|
||||
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const mutation = useMutation(
|
||||
(network: IrcNetwork) => APIClient.irc.updateNetwork(network),
|
||||
{
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { useMutation, useQuery } from "react-query";
|
||||
import { useMutation, useQuery, useQueryClient } from "react-query";
|
||||
import { APIClient } from "../../api/APIClient";
|
||||
import { GithubRelease } from "../../types/Update";
|
||||
import { toast } from "react-hot-toast";
|
||||
import Toast from "../../components/notifications/Toast";
|
||||
import { queryClient } from "../../App";
|
||||
import Select, { components, ControlProps, InputProps, MenuProps, OptionProps } from "react-select";
|
||||
import { LogLevelOptions, SelectOption } from "../../domain/constants";
|
||||
import { LogFiles } from "../Logs";
|
||||
|
@ -132,6 +131,8 @@ function LogSettings() {
|
|||
}
|
||||
);
|
||||
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const setLogLevelUpdateMutation = useMutation(
|
||||
(value: string) => APIClient.config.update({ log_level: value }),
|
||||
{
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import { useRef } from "react";
|
||||
import { useMutation } from "react-query";
|
||||
import { useMutation, useQueryClient } from "react-query";
|
||||
import { toast } from "react-hot-toast";
|
||||
|
||||
import { APIClient } from "../../api/APIClient";
|
||||
import Toast from "../../components/notifications/Toast";
|
||||
import { queryClient } from "../../App";
|
||||
import { useToggle } from "../../hooks/hooks";
|
||||
import { DeleteModal } from "../../components/modals";
|
||||
|
||||
function ReleaseSettings() {
|
||||
const [deleteModalIsOpen, toggleDeleteModal] = useToggle(false);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const deleteMutation = useMutation(() => APIClient.release.delete(), {
|
||||
onSuccess: () => {
|
||||
toast.custom((t) => (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue