aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/src/apis/hooks/status.ts
blob: 66af943fc9b86c95b0cb7f5fe06980470b9c55cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { useIsMutating } from "@tanstack/react-query";
import { QueryKeys } from "@/apis/queries/keys";

export function useIsAnyActionRunning() {
  return (
    useIsMutating({
      mutationKey: [QueryKeys.Actions],
    }) > 0
  );
}

export function useIsMovieActionRunning() {
  return (
    useIsMutating({
      mutationKey: [QueryKeys.Actions, QueryKeys.Movies],
    }) > 0
  );
}

export function useIsSeriesActionRunning() {
  return (
    useIsMutating({
      mutationKey: [QueryKeys.Actions, QueryKeys.Series],
    }) > 0
  );
}

export function useIsAnyMutationRunning() {
  return useIsMutating() > 0;
}