fix(admin): display classCount and warnings in import response
This commit is contained in:
@@ -48,9 +48,14 @@ interface OrgTreeWithUsersResponse {
|
||||
}
|
||||
|
||||
interface ImportUsersResponse {
|
||||
teacherCount: number;
|
||||
studentCount: number;
|
||||
skipped: number;
|
||||
success: boolean;
|
||||
data: {
|
||||
teacherCount: number;
|
||||
studentCount: number;
|
||||
classCount: number;
|
||||
skipped: number;
|
||||
warnings: string[];
|
||||
};
|
||||
}
|
||||
|
||||
interface ClassMarkForm {
|
||||
@@ -291,10 +296,15 @@ const IntegrationConfigPage: React.FC = () => {
|
||||
};
|
||||
|
||||
const res = await api.post<ImportUsersResponse>('/sync/dingtalk/import-users', payload);
|
||||
const data = res.data;
|
||||
message.success(
|
||||
`导入完成:${res.teacherCount} 位老师,${res.studentCount} 位学生` +
|
||||
(res.skipped > 0 ? `,${res.skipped} 已跳过` : ''),
|
||||
`导入完成:${data.teacherCount} 位老师,${data.studentCount} 位学生` +
|
||||
(data.classCount ? `,${data.classCount} 个班级` : '') +
|
||||
(data.skipped > 0 ? `,${data.skipped} 已跳过` : ''),
|
||||
);
|
||||
if (data.warnings?.length > 0) {
|
||||
message.warning(data.warnings.join(';'), 8);
|
||||
}
|
||||
setDrawerOpen(false);
|
||||
} catch (e: unknown) {
|
||||
const err = e as { message?: string };
|
||||
|
||||
Reference in New Issue
Block a user