fix: delete loading

This commit is contained in:
xingyu4j
2025-05-19 11:10:38 +08:00
parent 8c42af49d2
commit 2ea9b4781e
5 changed files with 40 additions and 44 deletions

View File

@@ -19,7 +19,7 @@ import {
updateUserStatus,
} from '#/api/system/user';
import { DocAlert } from '#/components/doc-alert';
import { TableAction } from '#/components/table-action';
import { ACTION_KEY, TableAction } from '#/components/table-action';
import { $t } from '#/locales';
import { DICT_TYPE, getDictLabel } from '#/utils';
@@ -85,18 +85,16 @@ function onEdit(row: SystemUserApi.User) {
/** 删除用户 */
async function onDelete(row: SystemUserApi.User) {
const hideLoading = message.loading({
message.loading({
content: $t('ui.actionMessage.deleting', [row.username]),
duration: 0,
key: 'action_process_msg',
key: ACTION_KEY,
});
try {
await deleteUser(row.id as number);
message.success($t('ui.actionMessage.deleteSuccess', [row.username]));
onRefresh();
} catch {
hideLoading();
}
await deleteUser(row.id as number);
message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.username]),
key: ACTION_KEY,
});
onRefresh();
}
/** 重置密码 */