Skip to content

Commit 8985ac4

Browse files
lilixxsDiamondYuan
authored andcommitted
fix: dida365 报错
1 parent 46e2830 commit 8985ac4

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/common/backend/services/dida365/service.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ interface Dida365CheckResponse {
2525
closed: boolean;
2626
groupId: string;
2727
}[];
28-
projectGroups: {
28+
projectGroups?: {
2929
id: string;
3030
name: string;
3131
}[];
32-
tags: {
32+
tags?: {
3333
name: string;
3434
}[];
3535
}
@@ -84,9 +84,12 @@ export default class Dida365DocumentService implements DocumentService {
8484
getRepositories = async (): Promise<Repository[]> => {
8585
const dida365CheckResponse = await this.request.get<Dida365CheckResponse>(`batch/check/0`);
8686
const groupMap = new Map<string, string>();
87-
dida365CheckResponse.projectGroups.forEach((group) => {
88-
groupMap.set(group.id, group.name);
89-
});
87+
if (dida365CheckResponse.projectGroups) { // 检查 projectGroups 是否存在
88+
dida365CheckResponse.projectGroups.forEach((group) => {
89+
groupMap.set(group.id, group.name);
90+
});
91+
}
92+
9093
return dida365CheckResponse.projectProfiles
9194
.filter((o) => !o.closed)
9295
.map(({ id, name, groupId }) => ({

0 commit comments

Comments
 (0)