Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix use cases for Subscription delete requests #842

Merged
merged 8 commits into from
Jan 6, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -381,18 +381,26 @@ class Credentials extends React.Component {
const client = new Subscription();
const promisedDelete = client.deleteSubscription(subscriptionId);
promisedDelete.then((response) => {
if (response.status !== 200) {
if (response.status === 200) {
Alert.info(intl.formatMessage({
defaultMessage: 'Subscription deleted successfully!',
id: 'Apis.Details.Credentials.Credentials.subscription.deleted.successfully',
}));
}
if (response.status === 201) {
Alert.info(intl.formatMessage({
defaultMessage: 'Subscription Deletion Request Created!',
id: 'Apis.Details.Credentials.Credentials.subscription.request.created',
}));
}
if (response.status !== 200 && response.status !== 201) {
console.log(response);
Alert.info(intl.formatMessage({
defaultMessage: 'Something went wrong while deleting the Subscription!',
id: 'Apis.Details.Credentials.Credentials.something.went.wrong.with.subscription',
}));
return;
}
Alert.info(intl.formatMessage({
defaultMessage: 'Subscription deleted successfully!',
id: 'Apis.Details.Credentials.Credentials.subscription.deleted.successfully',
}));
if (updateSubscriptionData) updateSubscriptionData(this.updateData);
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,12 @@ class Subscriptions extends React.Component {

promisedDelete
.then((response) => {
if (response.status === 200) {
Alert.info(intl.formatMessage({
defaultMessage: 'Subscription deleted successfully!',
id: 'Applications.Details.Subscriptions.delete.success',
}));
}
if (response.status === 201) {
console.log(response);
Alert.info(intl.formatMessage({
Expand All @@ -316,18 +322,14 @@ class Subscriptions extends React.Component {
this.updateSubscriptions(applicationId);
return;
}
if (response.status !== 200) {
if (response.status !== 200 && response.status !== 201) {
console.log(response);
Alert.info(intl.formatMessage({
defaultMessage: 'Something went wrong while deleting the Subscription!',
id: 'Applications.Details.Subscriptions.something.went.wrong',
}));
return;
}
Alert.info(intl.formatMessage({
defaultMessage: 'Subscription deleted successfully!',
id: 'Applications.Details.Subscriptions.delete.success',
}));
const { subscriptions } = this.state;
for (const endpointIndex in subscriptions) {
if (
Expand Down
Loading