Fix breaking change in install app command (#20825)
add backward compatibility for twenty-sdk install command
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
export const INSTALL_APPLICATION = gql`
|
||||
mutation InstallApplication($universalIdentifier: String!) {
|
||||
installApplication(universalIdentifier: $universalIdentifier) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
export const INSTALL_MARKETPLACE_APP = gql`
|
||||
mutation InstallMarketplaceApp(
|
||||
$universalIdentifier: String!
|
||||
$version: String
|
||||
) {
|
||||
installMarketplaceApp(
|
||||
universalIdentifier: $universalIdentifier
|
||||
version: $version
|
||||
) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -4,25 +4,23 @@ import { t } from '@lingui/core/macro';
|
||||
import { useState } from 'react';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import {
|
||||
InstallMarketplaceAppDocument,
|
||||
type InstallMarketplaceAppMutation,
|
||||
InstallApplicationDocument,
|
||||
type InstallApplicationMutation,
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const useInstallMarketplaceApp = () => {
|
||||
const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();
|
||||
const [isInstalling, setIsInstalling] = useState(false);
|
||||
const [installMarketplaceAppMutation] = useMutation(
|
||||
InstallMarketplaceAppDocument,
|
||||
);
|
||||
const [installApplicationMutation] = useMutation(InstallApplicationDocument);
|
||||
|
||||
const install = async (variables: {
|
||||
universalIdentifier: string;
|
||||
version?: string;
|
||||
}): Promise<InstallMarketplaceAppMutation | null> => {
|
||||
}): Promise<InstallApplicationMutation | null> => {
|
||||
setIsInstalling(true);
|
||||
|
||||
try {
|
||||
const result = await installMarketplaceAppMutation({ variables });
|
||||
const result = await installApplicationMutation({ variables });
|
||||
|
||||
if (isDefined(result.data)) {
|
||||
enqueueSuccessSnackBar({
|
||||
|
||||
Reference in New Issue
Block a user