mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
ui: user_import: catch errors
This commit is contained in:
1 file changed
+7
-3
@@ -11,9 +11,13 @@ const page = new NamedPage('manage_user_import', () => {
|
||||
draft,
|
||||
});
|
||||
if (!draft) {
|
||||
Notification.success(i18n('Created {0} users.', res.users.length));
|
||||
await delay(2000);
|
||||
window.location.reload();
|
||||
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));
|
||||
await delay(2000);
|
||||
window.location.reload();
|
||||
}
|
||||
} else {
|
||||
$('[name="messages"]').text(res.messages.join('\n'));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user