@@ -72,7 +72,6 @@ export class ApiService {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: '*/*',
|
||||
'x-schema-version': '6',
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -115,7 +114,6 @@ export class ApiService {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: '*/*',
|
||||
'x-schema-version': '6',
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -143,4 +141,52 @@ export class ApiService {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async deleteApplication(packageJson: PackageJson): Promise<ApiResponse> {
|
||||
try {
|
||||
const mutation = `
|
||||
mutation DeleteApplication($packageJson: JSON!) {
|
||||
deleteApplication(packageJson: $packageJson)
|
||||
}
|
||||
`;
|
||||
|
||||
const variables = { packageJson };
|
||||
|
||||
const response: AxiosResponse = await this.client.post(
|
||||
'/metadata',
|
||||
{
|
||||
query: mutation,
|
||||
variables,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: '*/*',
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
if (response.data.errors) {
|
||||
return {
|
||||
success: false,
|
||||
error:
|
||||
response.data.errors[0]?.message || 'Failed to delete application',
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
data: response.data.data.deleteApplication,
|
||||
message: `Successfully deleted application: ${packageJson.name}`,
|
||||
};
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError(error) && error.response) {
|
||||
return {
|
||||
success: false,
|
||||
error: error.response.data?.errors?.[0]?.message || error.message,
|
||||
};
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user