Skip to content

Commit

Permalink
Added admin delete functionality to admin
Browse files Browse the repository at this point in the history
  • Loading branch information
Stardog committed Aug 8, 2017
1 parent 91bae9b commit 2be9008
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ exports.entry = {
manageredit: exports.APP_DIR + '/ManagerEdit/index.jsx',
roommatelist: exports.APP_DIR + '/RoommateList/index.jsx',
roommateform: exports.APP_DIR + '/RoommateForm/index.jsx',
roommatedelete: exports.APP_DIR + '/RoommateDelete/index.js',
settings: exports.APP_DIR + '/Settings/index.jsx',
reports: exports.APP_DIR+ '/Reports/index.jsx',
passwordchange: exports.APP_DIR + '/PasswordChange/index.jsx',
Expand Down
20 changes: 20 additions & 0 deletions javascript/RoommateDelete/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* global $ */

$(document).ready(function () {
$('#delete-roommate').click(deleteRoommate)
})

const deleteRoommate = function () {
if (confirm('Delete this roommate request?')) {
const roommateId = $(this).data('id')
$.ajax({
url: './properties/Roommate/' + roommateId,
dataType: 'json',
type: 'delete',
success: function () {
window.location.href('./properties/Roommate/list')
}.bind(this),
error: function () {}.bind(this),
})
}
}

0 comments on commit 2be9008

Please sign in to comment.