core&ui: fix defaultPriv edit (#444)

Co-authored-by: undefined <i@undefined.moe>
This commit is contained in:
pandaandundefined authored and GitHub committed 2022-10-18 11:45:00 +08:00
1 parent e964eec099
commit a230d1c7c3
5 files changed
+39 -38

No files matched your search

@@ -20,10 +20,11 @@ const page = new NamedPage('manage_user_priv', () => {
async function changeUserPriv(uid, priv) {
try {
const res = await request.post('', uid !== 'default' ? {
uid,
const res = await request.post('', {
uid: uid !== 'default' ? uid : 0,
priv,
} : { priv });
system: uid === 'default',
});
if (res.url && res.url !== window.location.href) window.location.href = res.url;
else {
Notification.success(i18n('Priv has been updated to {0}.', priv));
@@ -54,8 +55,8 @@ const page = new NamedPage('manage_user_priv', () => {
handleOpenUserPrivDialog(user.udoc);
}
$('[name="select_user"]').on('click', () => handleClickSelectUser());
$('[name="set_priv"]').on('click', (ev) => handleOpenUserPrivDialog(ev));
$(document).on('click', '[name="select_user"]', () => handleClickSelectUser());
$(document).on('click', '[name="set_priv"]', (ev) => handleOpenUserPrivDialog(ev));
});
export default page;