Skip to content

Commit a3371b4

Browse files
committed
Add AJAX to hook the Revoke Token route
1 parent a2dbb84 commit a3371b4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

SourceGithub/files/sourcegithub.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ SourceGithub.rest_api = function(endpoint) {
1919

2020
jQuery(document).ready(function($) {
2121
$('#hub_app_client_id, #hub_app_secret').change(set_visibility);
22+
$('#btn_auth_revoke').click(revoke_token);
2223
$('#webhook_create > button').click(webhook_create);
2324

2425
// The PHP code initially hides all token authorization elements using the.
@@ -59,6 +60,19 @@ jQuery(document).ready(function($) {
5960
}
6061
}
6162

63+
function revoke_token() {
64+
var repo_id = $('#repo_id').val();
65+
66+
$.ajax({
67+
type: 'DELETE',
68+
url: SourceGithub.rest_api(repo_id + '/token'),
69+
success: function(data, textStatus, xhr) {
70+
$('#hub_app_access_token').val('');
71+
set_visibility();
72+
}
73+
});
74+
}
75+
6276
function webhook_create() {
6377
var repo_id = $('#repo_id').val();
6478
var status_icon = $('#webhook_status > i');

0 commit comments

Comments
 (0)