Fix admin page links

This commit is contained in:
Daniel García 2019-01-21 23:41:27 +01:00
parent ce42b07a80
commit b8cabadd43
No known key found for this signature in database
GPG Key ID: FC8A7D14C3CD543A

View File

@ -21,7 +21,7 @@
</span> </span>
</div> </div>
<div style="flex: 0 0 100px;"> <div style="flex: 0 0 100px;">
<a class="mr-3" href="" onclick='deleteUser("{{Id}}", "{{Email}}");'>Delete User</a> <a class="mr-3" href="#" onclick='deleteUser("{{Id}}", "{{Email}}")'>Delete User</a>
</div> </div>
</div> </div>
</div> </div>
@ -55,15 +55,13 @@
return "data:image/svg+xml;base64," + data.toString(); return "data:image/svg+xml;base64," + data.toString();
} }
function _post(url, successMsg, errMsg, data) { function _post(url, successMsg, errMsg, data) {
$.post({ url: url, data: data }) $.post(url, data, function () {
.done(function () { alert(successMsg);
alert(successMsg); }).fail(function (e) {
reload(); const r = e.responseJSON;
}).fail(function (e) { const msg = r ? r.ErrorModel.Message : "Unknown error";
const r = e.responseJSON; alert(errMsg + ": " + msg);
const msg = r ? r.ErrorModel.Message : "Unknown error"; }).always(reload);
alert(errMsg + ": " + msg);
});
} }
function deleteUser(id, mail) { function deleteUser(id, mail) {
var input_mail = prompt("To delete user '" + mail + "', please type the name below") var input_mail = prompt("To delete user '" + mail + "', please type the name below")
@ -76,6 +74,7 @@
alert("Wrong email, please try again") alert("Wrong email, please try again")
} }
} }
return false;
} }
function inviteUser() { function inviteUser() {
inv = $("#email-invite"); inv = $("#email-invite");
@ -83,6 +82,7 @@
inv.val(""); inv.val("");
_post("/admin/invite/", "User invited correctly", _post("/admin/invite/", "User invited correctly",
"Error inviting user", data); "Error inviting user", data);
return false;
} }
let OrgTypes = { let OrgTypes = {