7415 serverless functions update environment variables in a dedicated tab in settings functions not a env file (#7939)
   
This commit is contained in:
@ -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: {
|
||||
|
||||
@ -15,7 +15,6 @@ export const useGetManyServerlessFunctions = () => {
|
||||
client: apolloMetadataClient ?? undefined,
|
||||
});
|
||||
return {
|
||||
serverlessFunctions:
|
||||
data?.serverlessFunctions?.edges.map(({ node }) => node) || [],
|
||||
serverlessFunctions: data?.findManyServerlessFunctions || [],
|
||||
};
|
||||
};
|
||||
|
||||
@ -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,
|
||||
};
|
||||
};
|
||||
|
||||
@ -29,8 +29,9 @@ export const useServerlessFunctionUpdateFormState = (
|
||||
code: undefined,
|
||||
});
|
||||
|
||||
const { serverlessFunction } =
|
||||
useGetOneServerlessFunction(serverlessFunctionId);
|
||||
const { serverlessFunction } = useGetOneServerlessFunction({
|
||||
id: serverlessFunctionId,
|
||||
});
|
||||
|
||||
const { loading } = useGetOneServerlessFunctionSourceCode({
|
||||
id: serverlessFunctionId,
|
||||
|
||||
Reference in New Issue
Block a user