S16 postgresql opslag added
All checks were successful
Build, test and publish / verify (push) Successful in 7m31s
All checks were successful
Build, test and publish / verify (push) Successful in 7m31s
This commit is contained in:
@@ -57,6 +57,8 @@ import { DialogFrame } from './dialog-frame';
|
||||
`,
|
||||
})
|
||||
export class GroupMembers implements OnInit {
|
||||
readonly revision = input<number>();
|
||||
private originalRevision?: number;
|
||||
readonly schoolId = input.required<number>();
|
||||
readonly group = input.required<DanceGroup>();
|
||||
readonly dancers = input.required<Dancer[]>();
|
||||
@@ -70,6 +72,7 @@ export class GroupMembers implements OnInit {
|
||||
);
|
||||
private readonly api = inject(SchoolApi);
|
||||
ngOnInit(): void {
|
||||
this.originalRevision = this.revision();
|
||||
this.memberIds.set([...this.group().dancerIds]);
|
||||
}
|
||||
async toggle(dancerId: number, event: Event): Promise<void> {
|
||||
@@ -82,7 +85,10 @@ export class GroupMembers implements OnInit {
|
||||
this.busy.set(true);
|
||||
this.error.set('');
|
||||
try {
|
||||
await firstValueFrom(this.api.membership(this.schoolId(), this.group().id, dancerId, add));
|
||||
await firstValueFrom(
|
||||
this.api.membership(this.schoolId(), this.group().id, dancerId, add, this.originalRevision),
|
||||
);
|
||||
if (this.originalRevision !== undefined) this.originalRevision++;
|
||||
this.memberIds.update((ids) =>
|
||||
add ? [...ids, dancerId] : ids.filter((id) => id !== dancerId),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user