mirror of
https://github.com/Alvin-Zilverstand/nginx-proxy-manager.git
synced 2026-11-29 17:37:52 +01:00
Converted to Vite since create-react-app is no longer being developed
This commit is contained in:
115 files changed
+2511
-10015
No files matched your search
@@ -1,24 +1,23 @@
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import {
|
||||
createCertificate,
|
||||
getCertificate,
|
||||
setCertificate,
|
||||
Certificate,
|
||||
} from "api/npm";
|
||||
import { useMutation, useQuery, useQueryClient } from "react-query";
|
||||
} from "src/api/npm";
|
||||
|
||||
const fetchCertificate = (id: any) => {
|
||||
return getCertificate(id);
|
||||
};
|
||||
|
||||
const useCertificate = (id: number, options = {}) => {
|
||||
return useQuery<Certificate, Error>(
|
||||
["certificate", id],
|
||||
() => fetchCertificate(id),
|
||||
{
|
||||
staleTime: 60 * 1000, // 1 minute
|
||||
...options,
|
||||
},
|
||||
);
|
||||
return useQuery<Certificate, Error>({
|
||||
queryKey: ["certificate", id],
|
||||
queryFn: () => fetchCertificate(id),
|
||||
staleTime: 60 * 1000, // 1 minute
|
||||
...options,
|
||||
});
|
||||
};
|
||||
|
||||
const useSetCertificate = () => {
|
||||
@@ -44,10 +43,10 @@ const useSetCertificate = () => {
|
||||
return () =>
|
||||
queryClient.setQueryData(["certificate", values.id], previousObject);
|
||||
},
|
||||
onError: (error, values, rollback: any) => rollback(),
|
||||
onError: (_, __, rollback: any) => rollback(),
|
||||
onSuccess: async ({ id }: Certificate) => {
|
||||
queryClient.invalidateQueries(["certificate", id]);
|
||||
queryClient.invalidateQueries("certificates");
|
||||
queryClient.invalidateQueries(["certificates"]);
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user