Skip to content

Commit

Permalink
Merge pull request #842 from Chilliwiddit/main
Browse files Browse the repository at this point in the history
Fix use cases for Subscription delete requests
  • Loading branch information
RakhithaRR authored Jan 6, 2025
2 parents 3f21062 + 4724012 commit af6a1d7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
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

0 comments on commit af6a1d7

Please sign in to comment.