Skip to content

Instantly share code, notes, and snippets.

@eyupfidan
Created May 17, 2023 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eyupfidan/efecd6071fc472a20e9df1933e16af2c to your computer and use it in GitHub Desktop.
Save eyupfidan/efecd6071fc472a20e9df1933e16af2c to your computer and use it in GitHub Desktop.
function showAlert(icon, title, text, url) {
Swal.fire({
icon: icon,
title: title,
text: text,
showDenyButton: false,
showCancelButton: true,
confirmButtonColor: "green",
confirmButtonText: "Onaylıyorum",
cancelButtonText: "Vazgeç",
}).then((result) => {
if (result.isConfirmed) {
const data = {
articleID: articleID
};
$.ajax({
url: url,
type: "POST",
data: JSON.stringify(data),
contentType: "application/json",
dataType: "json",
success: function(data) {
const { title, html, icon } = data;
Swal.fire(title, html, icon);
}
});
}
});
}
function acceptButton() {
showAlert('question', 'Emin misiniz?', 'Onayladığınız takdirde yayın planına eklenecektir!', 'api/release_checklist/accept');
}
function rejectButton() {
showAlert('danger', 'Emin misiniz?', 'Reddettiğiniz takdirde yayın planına eklenmeyecektir!', 'api/release_checklist/reject');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment