gitscope
← marzneshin / v0.6.2 / dashboard/src/features/settings/services/certificate.query.ts
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/features/settings/services/certificate.query.ts · TypeScript
Blame Raw
 1import { useQuery } from "@tanstack/react-query";
 2import { fetch } from "@marzneshin/utils";
 3import { NodesQueryFetchKey } from "@marzneshin/modules/nodes";
 4
 5export async function fetchCertificate(): Promise<string> {
 6    return fetch('/nodes/settings').then((settings) => {
 7        return settings.certificate;
 8    });
 9}
10
11export const CertificateQueryFetchKey = "settings";
12
13export const useCertificateQuery = () => {
14    return useQuery({
15        queryKey: [NodesQueryFetchKey, CertificateQueryFetchKey],
16        queryFn: fetchCertificate,
17        initialData: ''
18    })
19}