Skip to content

Commit e7ad7f1

Browse files
committed
🐛 [eb/sbf] increase compatibility with ausbildungs-mausschoner
1 parent 8448c37 commit e7ad7f1

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/modules/extendedBuilding/assets/schoolsBuildingFilter.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,21 @@ interface BuildingInfos {
88
}
99

1010
export default async (LSSM: Vue) => {
11-
const accordion = document.querySelector<HTMLDivElement>(
12-
'form[action$="/education"] #accordion'
13-
);
11+
const getAccordion = () =>
12+
document.querySelector<HTMLDivElement>(
13+
'form[action$="/education"] #accordion'
14+
);
1415

16+
// wait for Ausbildungs-Mausschoner to append buildings
17+
if (!getAccordion()) {
18+
await new Promise(resolve =>
19+
document.addEventListener(
20+
'ausbildungs-mausschoner:buildings-appended',
21+
resolve
22+
)
23+
);
24+
}
25+
const accordion = getAccordion();
1526
if (!accordion) return;
1627

1728
await LSSM.$stores.api.getBuildings('eb-sbf');

0 commit comments

Comments
 (0)