Skip to content

Commit

Permalink
don't allow joining the exercise without ticking the checkbox
Browse files Browse the repository at this point in the history
Signed-off-by: anonym-HPI <[email protected]>
  • Loading branch information
anonym-HPI committed Nov 17, 2023
1 parent 6d7764a commit 9154eef
Showing 1 changed file with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Component } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { Subject } from 'rxjs';
import { ApplicationService } from 'src/app/core/application.service';
import { MessageService } from 'src/app/core/messages/message.service';

@Component({
selector: 'app-join-exercise-modal',
Expand All @@ -21,20 +22,29 @@ export class JoinExerciseModalComponent implements OnDestroy {

constructor(
private readonly applicationService: ApplicationService,
private readonly activeModal: NgbActiveModal
private readonly activeModal: NgbActiveModal,
private readonly messageService: MessageService
) {}

public toggleAgreedToTermsAndPrivacyPolicy(event: boolean) {
this.agreedToTermsAndPrivacyPolicy = event;
}

public async joinExercise() {
const successfullyJoined = await this.applicationService.joinExercise(
this.exerciseId,
this.clientName
);
this.exerciseJoined$.next(successfullyJoined);
this.activeModal.close();
if (this.agreedToTermsAndPrivacyPolicy) {
const successfullyJoined =
await this.applicationService.joinExercise(
this.exerciseId,
this.clientName
);
this.exerciseJoined$.next(successfullyJoined);
this.activeModal.close();
} else {
this.messageService.postMessage({
title: 'Fehler: Bedinungen nicht zugestimmt',
color: 'warning',
});
}
}

public close() {
Expand Down

0 comments on commit 9154eef

Please sign in to comment.