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 @@ ...@@ -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