Refactor openCard method in ApplicantsDialog to streamline error handling and remove redundant checks against selectedId. This improves code clarity and maintains state management consistency.
This commit is contained in:
@@ -295,16 +295,8 @@ export class ApplicantsDialog {
|
||||
private async openCard(personId: string): Promise<void> {
|
||||
try {
|
||||
const card = await fetchPerson(this.options.schoolId, personId, getLocale());
|
||||
if (personId !== this.selectedId) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.paintCard(card);
|
||||
} catch {
|
||||
if (personId !== this.selectedId) {
|
||||
return;
|
||||
}
|
||||
|
||||
clear(this.card);
|
||||
this.card.append(el('p', { class: 'panel__empty', text: t('peopleCardFailed') }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user