mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: user_import: catch errors
This commit is contained in:
1 file changed
+4
@@ -11,9 +11,13 @@ const page = new NamedPage('manage_user_import', () => {
|
|||||||
draft,
|
draft,
|
||||||
});
|
});
|
||||||
if (!draft) {
|
if (!draft) {
|
||||||
|
if (res.url) window.location.href = res.url;
|
||||||
|
else if (res.error) throw new Error(res.error?.message || res.error);
|
||||||
|
else {
|
||||||
Notification.success(i18n('Created {0} users.', res.users.length));
|
Notification.success(i18n('Created {0} users.', res.users.length));
|
||||||
await delay(2000);
|
await delay(2000);
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$('[name="messages"]').text(res.messages.join('\n'));
|
$('[name="messages"]').text(res.messages.join('\n'));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user