mirror of
https://github.com/docmost/docmost.git
synced 2026-05-15 13:14:11 +08:00
78b1c1a453
* add cursor pagination function * support custom order modifier * refactor returned object * feat(db): migrate paginated endpoints to cursor-based pagination * sync * support hasPrevPage boolean * feat(client): migrate pagination from offset to cursor-based * support beforeCursor/prevCursor * wrap search results in items array for API consistency
83 lines
2.2 KiB
TypeScript
83 lines
2.2 KiB
TypeScript
import { queryClient } from "@/main.tsx";
|
|
import {
|
|
getBilling,
|
|
getBillingPlans,
|
|
} from "@/ee/billing/services/billing-service.ts";
|
|
import { getSpaces } from "@/features/space/services/space-service.ts";
|
|
import { getGroups } from "@/features/group/services/group-service.ts";
|
|
import { QueryParams } from "@/lib/types.ts";
|
|
import { getWorkspaceMembers } from "@/features/workspace/services/workspace-service.ts";
|
|
import { getLicenseInfo } from "@/ee/licence/services/license-service.ts";
|
|
import { getSsoProviders } from "@/ee/security/services/security-service.ts";
|
|
import { getShares } from "@/features/share/services/share-service.ts";
|
|
import { getApiKeys } from "@/ee/api-key";
|
|
|
|
export const prefetchWorkspaceMembers = () => {
|
|
const params: QueryParams = { limit: 100, query: "" };
|
|
queryClient.prefetchQuery({
|
|
queryKey: ["workspaceMembers", params],
|
|
queryFn: () => getWorkspaceMembers(params),
|
|
});
|
|
};
|
|
|
|
export const prefetchSpaces = () => {
|
|
queryClient.prefetchQuery({
|
|
queryKey: ["spaces", {}],
|
|
queryFn: () => getSpaces({}),
|
|
});
|
|
};
|
|
|
|
export const prefetchGroups = () => {
|
|
queryClient.prefetchQuery({
|
|
queryKey: ["groups", {}],
|
|
queryFn: () => getGroups({}),
|
|
});
|
|
};
|
|
|
|
export const prefetchBilling = () => {
|
|
queryClient.prefetchQuery({
|
|
queryKey: ["billing"],
|
|
queryFn: () => getBilling(),
|
|
});
|
|
|
|
queryClient.prefetchQuery({
|
|
queryKey: ["billing-plans"],
|
|
queryFn: () => getBillingPlans(),
|
|
});
|
|
};
|
|
|
|
export const prefetchLicense = () => {
|
|
queryClient.prefetchQuery({
|
|
queryKey: ["license"],
|
|
queryFn: () => getLicenseInfo(),
|
|
});
|
|
};
|
|
|
|
export const prefetchSsoProviders = () => {
|
|
queryClient.prefetchQuery({
|
|
queryKey: ["sso-providers"],
|
|
queryFn: () => getSsoProviders(),
|
|
});
|
|
};
|
|
|
|
export const prefetchShares = () => {
|
|
queryClient.prefetchQuery({
|
|
queryKey: ["share-list", {}],
|
|
queryFn: () => getShares({}),
|
|
});
|
|
};
|
|
|
|
export const prefetchApiKeys = () => {
|
|
queryClient.prefetchQuery({
|
|
queryKey: ["api-key-list", {}],
|
|
queryFn: () => getApiKeys({}),
|
|
});
|
|
};
|
|
|
|
export const prefetchApiKeyManagement = () => {
|
|
queryClient.prefetchQuery({
|
|
queryKey: ["api-key-list", { adminView: true }],
|
|
queryFn: () => getApiKeys({ adminView: true }),
|
|
});
|
|
};
|