Commit 744e367f authored by Mike Greiling's avatar Mike Greiling

Merge branch 'remove-IIFEs-from-jira_connect.js' into 'master'

remove IIFE from jira_connect.js

See merge request gitlab-org/gitlab!19248
parents 3cd7f380 fc1301db
......@@ -9,49 +9,48 @@
* hence any code written here needs to be IE11+ compatible (no fully ES6)
*/
(function() {
document.addEventListener('DOMContentLoaded', function() {
var reqComplete = function() {
AP.navigator.reload();
};
function onLoaded() {
var reqComplete = function() {
AP.navigator.reload();
};
var reqFailed = function(res) {
alert(res.responseJSON.error);
};
var reqFailed = function(res) {
alert(res.responseJSON.error);
};
$('#add-subscription-form').on('submit', function(e) {
var actionUrl = $(this).attr('action');
e.preventDefault();
$('#add-subscription-form').on('submit', function(e) {
var actionUrl = $(this).attr('action');
e.preventDefault();
AP.context.getToken(function(token) {
// eslint-disable-next-line no-jquery/no-ajax
$.post(actionUrl, {
jwt: token,
namespace_path: $('#namespace-input').val(),
format: 'json',
})
.done(reqComplete)
.fail(reqFailed);
});
AP.context.getToken(function(token) {
// eslint-disable-next-line no-jquery/no-ajax
$.post(actionUrl, {
jwt: token,
namespace_path: $('#namespace-input').val(),
format: 'json',
})
.done(reqComplete)
.fail(reqFailed);
});
});
$('.remove-subscription').on('click', function(e) {
var href = $(this).attr('href');
e.preventDefault();
$('.remove-subscription').on('click', function(e) {
var href = $(this).attr('href');
e.preventDefault();
AP.context.getToken(function(token) {
// eslint-disable-next-line no-jquery/no-ajax
$.ajax({
url: href,
method: 'DELETE',
data: {
jwt: token,
format: 'json',
},
})
.done(reqComplete)
.fail(reqFailed);
});
AP.context.getToken(function(token) {
// eslint-disable-next-line no-jquery/no-ajax
$.ajax({
url: href,
method: 'DELETE',
data: {
jwt: token,
format: 'json',
},
})
.done(reqComplete)
.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