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> {
|
private async openCard(personId: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const card = await fetchPerson(this.options.schoolId, personId, getLocale());
|
const card = await fetchPerson(this.options.schoolId, personId, getLocale());
|
||||||
if (personId !== this.selectedId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.paintCard(card);
|
this.paintCard(card);
|
||||||
} catch {
|
} catch {
|
||||||
if (personId !== this.selectedId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
clear(this.card);
|
clear(this.card);
|
||||||
this.card.append(el('p', { class: 'panel__empty', text: t('peopleCardFailed') }));
|
this.card.append(el('p', { class: 'panel__empty', text: t('peopleCardFailed') }));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user