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