@refinedev/core
Version:
refine is a React-based framework for building internal tools, rapidly. It ships with Ant Design System, an enterprise-level UI toolkit.
20 lines (16 loc) • 520 B
text/typescript
import { useKeys } from "@hooks/useKeys";
import { useQueryClient } from "@tanstack/react-query";
export const useInvalidateAuthStore = () => {
const queryClient = useQueryClient();
const { keys, preferLegacyKeys } = useKeys();
const invalidate = async () => {
await Promise.all(
(["check", "identity", "permissions"] as const).map((action) =>
queryClient.invalidateQueries(
keys().auth().action(action).get(preferLegacyKeys),
),
),
);
};
return invalidate;
};