d2ddd6f473
Moves system-level operations (auth, billing, admin) to use the /metadata endpoint instead of /graphql. This cleans up the endpoint separation so /graphql is purely for core objects (Company, People, etc.) and /metadata handles all system operations. Part of prep work for webhook/API key core migration.
35 lines
877 B
TypeScript
35 lines
877 B
TypeScript
import { useMutation } from '@apollo/client';
|
|
|
|
import { UPDATE_ONE_DATABASE_CONNECTION } from '@/databases/graphql/mutations/updateOneDatabaseConnection';
|
|
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
|
|
import {
|
|
UpdateRemoteServerInput,
|
|
UpdateServerMutation,
|
|
UpdateServerMutationVariables,
|
|
} from '~/generated-metadata/graphql';
|
|
|
|
export const useUpdateOneDatabaseConnection = () => {
|
|
const apolloMetadataClient = useApolloCoreClient();
|
|
|
|
const [mutate] = useMutation<
|
|
UpdateServerMutation,
|
|
UpdateServerMutationVariables
|
|
>(UPDATE_ONE_DATABASE_CONNECTION, {
|
|
client: apolloMetadataClient,
|
|
});
|
|
|
|
const updateOneDatabaseConnection = async (
|
|
input: UpdateRemoteServerInput,
|
|
) => {
|
|
return await mutate({
|
|
variables: {
|
|
input,
|
|
},
|
|
});
|
|
};
|
|
|
|
return {
|
|
updateOneDatabaseConnection,
|
|
};
|
|
};
|