diff --git a/src/app/shared/error-dialog/error-dialog.component.ts b/src/app/shared/error-dialog/error-dialog.component.ts index 08f638fe5609d2ac4d3c65a715128f6a2f3e8438..8574cad8535f99c8ce6417ccccefc0eb589479e9 100644 --- a/src/app/shared/error-dialog/error-dialog.component.ts +++ b/src/app/shared/error-dialog/error-dialog.component.ts @@ -1,22 +1,32 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { ErrorModel } from '../../models/error.model'; import { ErrorService } from '../../services/error.service'; -import { ModalDismissReasons, NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { Router } from '@angular/router'; +/** + * Component that opens a new dialog if the errorService is updated + */ @Component({ selector: 'app-error-dialog', templateUrl: './error-dialog.component.html', styleUrls: ['./error-dialog.component.css'], }) export class ErrorDialogComponent implements OnInit { + /** + * Error that will be displayed + */ error: ErrorModel; + /** + * Get the modal from template + */ @ViewChild('modalData') modalData: any; - closeModal: string; - constructor(private errorService: ErrorService, private modalService: NgbModal, private router: Router) {} + /** + * Subscribe to the ErrorService and trigger the modal on change + */ ngOnInit(): void { this.errorService.errorData$.subscribe((e) => { if (e) { @@ -26,10 +36,16 @@ export class ErrorDialogComponent implements OnInit { }); } + /** + * Open the modal + */ triggerModal(): void { this.modalService.open(this.modalData, { ariaLabelledBy: 'modal-basic-title' }); } + /** + * Redirect to the given route in the error + */ redirectToHome(): void { if (this.error.navigate) { this.router.navigate(this.error.navigate); diff --git a/src/app/shared/loader/loader.component.ts b/src/app/shared/loader/loader.component.ts index 3a2839dc012ac3696d8abc0980dcd06c777d0db0..b01dcc4231958c2aa66e22d549ac4156bd4ea971 100644 --- a/src/app/shared/loader/loader.component.ts +++ b/src/app/shared/loader/loader.component.ts @@ -1,11 +1,17 @@ import { Component, Input, OnInit } from '@angular/core'; +/** + * Basic bootstrap loader component. + */ @Component({ selector: 'app-loader', templateUrl: './loader.component.html', styleUrls: ['./loader.component.css'] }) export class LoaderComponent implements OnInit { + /** + * colorClass that can be overwritten + */ @Input() colorClass?: string; constructor() { } diff --git a/src/app/shared/must-match-validator.directive.ts b/src/app/shared/must-match-validator.directive.ts index d8a9c7cf410014cca3450a4184bc1bccfc4d9a9f..21d20ef8ff709404c7e549a59cb06a97d08b617d 100644 --- a/src/app/shared/must-match-validator.directive.ts +++ b/src/app/shared/must-match-validator.directive.ts @@ -1,5 +1,10 @@ import { AbstractControl, FormGroup, ValidationErrors, ValidatorFn } from '@angular/forms'; +/** + * A validator that can be used to specify which fields should equal in a formGroup + * @param controlName first control in formGroup + * @param matchingControlName the matching control in formGroup + */ export const mustMatchValidator = (controlName: string, matchingControlName: string): ValidatorFn => ( control: AbstractControl ): ValidationErrors | null => { diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 3612073bc31cd4c1f5d6cbb00318521e9a61bd8a..40ffc994fe059ac5b8462674b5989fb4411e4f51 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,3 +1,5 @@ export const environment = { - production: true + production: true, + apiUrl: 'https://stat.maze.sch.bme.hu/api/v1', + jwtRefreshBeforeMinutes: 10 };