mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 12:39:53 +01:00
Adjust TypeScript logic for list member count
This commit is contained in:
parent
1492434e15
commit
6dac157aef
1 changed files with 4 additions and 2 deletions
|
@ -5,7 +5,8 @@ import I18n from 'retrospring/i18n';
|
|||
export function listMembershipHandler(event: Event): void {
|
||||
const checkbox = event.target as HTMLInputElement;
|
||||
const list = checkbox.dataset.list;
|
||||
let memberCount = Number(document.querySelector(`span#${list}-members`).innerHTML);
|
||||
const memberCountElement: HTMLElement = document.querySelector(`span#${list}-members`);
|
||||
let memberCount = Number(memberCountElement.dataset.count);
|
||||
|
||||
checkbox.setAttribute('disabled', 'disabled');
|
||||
|
||||
|
@ -22,7 +23,8 @@ export function listMembershipHandler(event: Event): void {
|
|||
success: (data) => {
|
||||
if (data.success) {
|
||||
checkbox.checked = data.checked;
|
||||
document.querySelector(`span#${list}-members`).innerHTML = memberCount.toString();
|
||||
memberCountElement.innerHTML = memberCountElement.dataset.i18n.replace('%{count}', memberCount.toString());
|
||||
memberCountElement.dataset.count = memberCount.toString();
|
||||
}
|
||||
|
||||
showNotification(data.message, data.success);
|
||||
|
|
Loading…
Reference in a new issue