Merge pull request #1723 from automatisch/remove-unused-payloads

refactor: remove unused payloads from RQ
This commit is contained in:
Ali BARIN
2024-03-15 13:53:45 +01:00
committed by GitHub
12 changed files with 34 additions and 28 deletions

View File

@@ -2,10 +2,10 @@ import { useQuery } from '@tanstack/react-query';
import api from 'helpers/api';
export default function useActionSubsteps(appKey, actionKey) {
export default function useActionSubsteps({ appKey, actionKey }) {
const query = useQuery({
queryKey: ['actionSubsteps', appKey, actionKey],
queryFn: async ({ payload, signal }) => {
queryFn: async ({ signal }) => {
const { data } = await api.get(
`/v1/apps/${appKey}/actions/${actionKey}/substeps`,
{

View File

@@ -5,7 +5,7 @@ import api from 'helpers/api';
export default function useActions(appKey) {
const query = useQuery({
queryKey: ['actions', appKey],
queryFn: async ({ payload, signal }) => {
queryFn: async ({ signal }) => {
const { data } = await api.get(`/v1/apps/${appKey}/actions`, {
signal,
});

View File

@@ -5,7 +5,7 @@ import api from 'helpers/api';
export default function useAdminAppAuthClient(id) {
const query = useQuery({
queryKey: ['adminAppAuthClient', id],
queryFn: async ({ payload, signal }) => {
queryFn: async ({ signal }) => {
const { data } = await api.get(`/v1/admin/app-auth-clients/${id}`, {
signal,
});

View File

@@ -5,7 +5,7 @@ import api from 'helpers/api';
export default function useApp(appKey) {
const query = useQuery({
queryKey: ['app', appKey],
queryFn: async ({ payload, signal }) => {
queryFn: async ({ signal }) => {
const { data } = await api.get(`/v1/apps/${appKey}`, {
signal,
});

View File

@@ -5,7 +5,7 @@ import api from 'helpers/api';
export default function useAppAuth(appKey) {
const query = useQuery({
queryKey: ['appAuth', appKey],
queryFn: async ({ payload, signal }) => {
queryFn: async ({ signal }) => {
const { data } = await api.get(`/v1/apps/${appKey}/auth`, {
signal,
});

View File

@@ -4,7 +4,7 @@ import api from 'helpers/api';
export default function useAppConfig(appKey) {
const query = useQuery({
queryKey: ['appConfig', appKey],
queryFn: async ({ payload, signal }) => {
queryFn: async ({ signal }) => {
const { data } = await api.get(`/v1/app-configs/${appKey}`, {
signal,
});

View File

@@ -3,11 +3,15 @@ import { useQuery } from '@tanstack/react-query';
import api from 'helpers/api';
export default function useApps(variables) {
const trueOnlyVariables = Object.fromEntries(
Object.entries(variables).filter(([_, value]) => value === true),
);
const query = useQuery({
queryKey: ['apps', variables],
queryFn: async ({ payload, signal }) => {
queryKey: ['apps', trueOnlyVariables],
queryFn: async ({ signal }) => {
const { data } = await api.get('/v1/apps', {
params: variables,
params: trueOnlyVariables,
signal,
});

View File

@@ -3,7 +3,7 @@ import { useMutation } from '@tanstack/react-query';
import api from 'helpers/api';
import React from 'react';
export default function useLazyApps({ appName, onSuccess }) {
export default function useLazyApps({ appName } = {}, { onSuccess }) {
const abortControllerRef = React.useRef(new AbortController());
React.useEffect(() => {
@@ -15,7 +15,7 @@ export default function useLazyApps({ appName, onSuccess }) {
}, [appName]);
const query = useMutation({
mutationFn: async ({ payload }) => {
mutationFn: async () => {
const { data } = await api.get('/v1/apps', {
params: { name: appName },
signal: abortControllerRef.current.signal,

View File

@@ -2,10 +2,10 @@ import { useQuery } from '@tanstack/react-query';
import api from 'helpers/api';
export default function useTriggerSubsteps(appKey, triggerKey) {
export default function useTriggerSubsteps({ appKey, triggerKey }) {
const query = useQuery({
queryKey: ['triggerSubsteps', appKey, triggerKey],
queryFn: async ({ payload, signal }) => {
queryFn: async ({ signal }) => {
const { data } = await api.get(
`/v1/apps/${appKey}/triggers/${triggerKey}/substeps`,
{

View File

@@ -5,7 +5,7 @@ import api from 'helpers/api';
export default function useTriggers(appKey) {
const query = useQuery({
queryKey: ['triggers', appKey],
queryFn: async ({ payload, signal }) => {
queryFn: async ({ signal }) => {
const { data } = await api.get(`/v1/apps/${appKey}/triggers`, {
signal,
});