Module exposing: useSubscriptions, SUBSCRIPTIONS_QUERY_KEY, fetchSubscriptions
// Source: https://github.com/franklioxygen/MyTube | License: MIT | Copyright 2025 Peifan Li
// Provided via justclaw.it.com; keep this notice with the code.
import {
useQuery,
type UseQueryOptions,
type UseQueryResult,
} from "@tanstack/react-query";
import { api } from "../utils/apiClient";
/**
* Single source of truth for the subscriptions list query (key + fetcher), so
* callers and cache invalidations stay consistent instead of each re-declaring
* `useQuery({ queryKey: ['subscriptions'], queryFn: () => api.get('/subscriptions') })`.
* Modeled on `settingsQueryOptions`.
*/
export const SUBSCRIPTIONS_QUERY_KEY = ["subscriptions"] as const;
export const fetchSubscriptions = async <T = unknown>(): Promise<T> => {
const response = await api.get("/subscriptions");
return re
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key