martmull
2024-10-22 14:51:03 +02:00
committed by GitHub
parent 7fc844ea8f
commit e767f16dbe
26 changed files with 547 additions and 242 deletions

View File

@ -3,7 +3,7 @@ import { ApolloClient, useMutation } from '@apollo/client';
import { getOperationName } from '@apollo/client/utilities';
import { DELETE_ONE_SERVERLESS_FUNCTION } from '@/settings/serverless-functions/graphql/mutations/deleteOneServerlessFunction';
import {
DeleteServerlessFunctionInput,
ServerlessFunctionIdInput,
DeleteOneServerlessFunctionMutation,
DeleteOneServerlessFunctionMutationVariables,
} from '~/generated-metadata/graphql';
@ -19,7 +19,7 @@ export const useDeleteOneServerlessFunction = () => {
});
const deleteOneServerlessFunction = async (
input: DeleteServerlessFunctionInput,
input: ServerlessFunctionIdInput,
) => {
return await mutate({
variables: {

View File

@ -15,7 +15,6 @@ export const useGetManyServerlessFunctions = () => {
client: apolloMetadataClient ?? undefined,
});
return {
serverlessFunctions:
data?.serverlessFunctions?.edges.map(({ node }) => node) || [],
serverlessFunctions: data?.findManyServerlessFunctions || [],
};
};

View File

@ -2,11 +2,14 @@ import { useQuery } from '@apollo/client';
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
import { FIND_ONE_SERVERLESS_FUNCTION } from '@/settings/serverless-functions/graphql/queries/findOneServerlessFunction';
import {
ServerlessFunctionIdInput,
GetOneServerlessFunctionQuery,
GetOneServerlessFunctionQueryVariables,
} from '~/generated-metadata/graphql';
export const useGetOneServerlessFunction = (id: string) => {
export const useGetOneServerlessFunction = (
input: ServerlessFunctionIdInput,
) => {
const apolloMetadataClient = useApolloMetadataClient();
const { data } = useQuery<
GetOneServerlessFunctionQuery,
@ -14,10 +17,10 @@ export const useGetOneServerlessFunction = (id: string) => {
>(FIND_ONE_SERVERLESS_FUNCTION, {
client: apolloMetadataClient ?? undefined,
variables: {
id,
input,
},
});
return {
serverlessFunction: data?.serverlessFunction || null,
serverlessFunction: data?.findOneServerlessFunction || null,
};
};

View File

@ -29,8 +29,9 @@ export const useServerlessFunctionUpdateFormState = (
code: undefined,
});
const { serverlessFunction } =
useGetOneServerlessFunction(serverlessFunctionId);
const { serverlessFunction } = useGetOneServerlessFunction({
id: serverlessFunctionId,
});
const { loading } = useGetOneServerlessFunctionSourceCode({
id: serverlessFunctionId,