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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -381,18 +381,27 @@ 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