gitscope
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/features/subscription-settings/services/subscription-settings.query.ts · v0.5.0
Source
1 0178858 Dawsh 2y ago import { SubscriptionSettingsType } from "@marzneshin/features/subscription-settings";
2 0178858 Dawsh 2y ago import { useQuery } from "@tanstack/react-query";
3 0178858 Dawsh 2y ago import { fetch } from "@marzneshin/utils";
4 0178858 Dawsh 2y ago
5 0178858 Dawsh 2y ago export async function fetchSubscriptionSettings(): Promise<SubscriptionSettingsType> {
6 0178858 Dawsh 2y ago return fetch(`/system/settings/subscription`);
7 0178858 Dawsh 2y ago }
8 0178858 Dawsh 2y ago
9 0178858 Dawsh 2y ago export const subscriptionSettingsQueryKey = ["system", "settings", "subscription"]
10 0178858 Dawsh 2y ago
11 0178858 Dawsh 2y ago export const useSubscriptionSettingsQuery = () => {
12 0178858 Dawsh 2y ago return useQuery({
13 0178858 Dawsh 2y ago queryKey: subscriptionSettingsQueryKey,
14 0178858 Dawsh 2y ago queryFn: fetchSubscriptionSettings,
15 0178858 Dawsh 2y ago initialData: {
16 89eec32 Dawsh 2y ago // url_prefix: "",
17 89eec32 Dawsh 2y ago template_on_acceptance: false,
18 0178858 Dawsh 2y ago profile_title: "",
19 0178858 Dawsh 2y ago support_link: "",
20 0178858 Dawsh 2y ago update_interval: 0,
21 0178858 Dawsh 2y ago rules: [],
22 0178858 Dawsh 2y ago },
23 0178858 Dawsh 2y ago });
24 0178858 Dawsh 2y ago };