All files / react-app/src/api useGetPackageActions.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 3/3
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20            73x 9x   73x       3x   1x        
import { Action, ReactQueryApiError } from "shared-types";
import { API } from "aws-amplify";
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
type PackageActionsResponse = {
  actions: Action[];
};
export const getPackageActions = async (id: string): Promise<PackageActionsResponse> =>
  await API.post("os", "/getPackageActions", { body: { id } });
 
export const useGetPackageActions = (
  id: string,
  options?: UseQueryOptions<PackageActionsResponse, ReactQueryApiError>,
) => {
  return useQuery<PackageActionsResponse, ReactQueryApiError>(
    ["actions", id],
    () => getPackageActions(id),
    options,
  );
};