Commit fc1301db authored by Marvin Karegyeya's avatar Marvin Karegyeya Committed by Mike Greiling

remove IIFE from jira_connect.js

parent 3cd7f380
...@@ -9,49 +9,48 @@ ...@@ -9,49 +9,48 @@
* hence any code written here needs to be IE11+ compatible (no fully ES6) * hence any code written here needs to be IE11+ compatible (no fully ES6)
*/ */
(function() { function onLoaded() {
document.addEventListener('DOMContentLoaded', function() { var reqComplete = function() {
var reqComplete = function() { AP.navigator.reload();
AP.navigator.reload(); };
};
var reqFailed = function(res) { var reqFailed = function(res) {
alert(res.responseJSON.error); alert(res.responseJSON.error);
}; };
$('#add-subscription-form').on('submit', function(e) { $('#add-subscription-form').on('submit', function(e) {
var actionUrl = $(this).attr('action'); var actionUrl = $(this).attr('action');
e.preventDefault(); e.preventDefault();
AP.context.getToken(function(token) { AP.context.getToken(function(token) {
// eslint-disable-next-line no-jquery/no-ajax // eslint-disable-next-line no-jquery/no-ajax
$.post(actionUrl, { $.post(actionUrl, {
jwt: token, jwt: token,
namespace_path: $('#namespace-input').val(), namespace_path: $('#namespace-input').val(),
format: 'json', format: 'json',
}) })
.done(reqComplete) .done(reqComplete)
.fail(reqFailed); .fail(reqFailed);
});
}); });
});
$('.remove-subscription').on('click', function(e) { $('.remove-subscription').on('click', function(e) {
var href = $(this).attr('href'); var href = $(this).attr('href');
e.preventDefault(); e.preventDefault();
AP.context.getToken(function(token) { AP.context.getToken(function(token) {
// eslint-disable-next-line no-jquery/no-ajax // eslint-disable-next-line no-jquery/no-ajax
$.ajax({ $.ajax({
url: href, url: href,
method: 'DELETE', method: 'DELETE',
data: { data: {
jwt: token, jwt: token,
format: 'json', format: 'json',
}, },
}) })
.done(reqComplete) .done(reqComplete)
.fail(reqFailed); .fail(reqFailed);
});
}); });
}); });
})(); }
document.addEventListener('DOMContentLoaded', onLoaded);
---
title: Remove IIFEs from jira_connect.js file
merge_request: 19248
author: nuwe1
type: other
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment