Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Sofia Papacharalampous 2024-06-17 14:30:35 +03:00
commit 5037ca33fa
3 changed files with 31 additions and 18 deletions

View File

@ -74,6 +74,12 @@ export class AuthService extends BaseService {
) {
this.selectedTenant(event.newValue);
window.location.href = this.tenantHandlingService.getCurrentUrlEnrichedWithTenantCode(event.newValue, true);
} else if (
event.key &&
event.key === 'refreshPage' &&
event.newValue == 'true'
) {
window.location.reload();
}
});
}

View File

@ -41,15 +41,15 @@ export class MergeEmailConfirmation extends BaseComponent implements OnInit {
const token = params['token']
if (token != null) {
this.userService.getUserTokenPermission(token)
.subscribe(result => {
this.isTokenValid = result
this.token = token;
}, error => {
this.token = Guid.createEmpty();
this.onCallbackError(error);
});
.subscribe(result => {
this.isTokenValid = result
this.token = token;
}, error => {
this.token = Guid.createEmpty();
this.onCallbackError(error);
});
}
});
});
}
onConfirm(): void {
@ -61,14 +61,16 @@ export class MergeEmailConfirmation extends BaseComponent implements OnInit {
this.onCallbackEmailConfirmationSuccess();
}
},
error => this.onCallbackError(error));
error => this.onCallbackError(error));
}
onCallbackEmailConfirmationSuccess() {
this.router.navigate([this.routerUtils.generateUrl('home')])
.then(() => {
window.location.reload();
});
.then(() => {
localStorage.setItem('refreshPage', null);
localStorage.setItem('refreshPage', 'true');
window.location.reload();
});
}
onCallbackError(errorResponse: HttpErrorResponse) {
@ -76,7 +78,7 @@ export class MergeEmailConfirmation extends BaseComponent implements OnInit {
errorOverrides.set(302, this.language.instant('EMAIL-CONFIRMATION.EMAIL-FOUND'));
errorOverrides.set(403, this.language.instant('EMAIL-CONFIRMATION.EXPIRED-EMAIL'));
this.httpErrorHandlingService.handleBackedRequestError(errorResponse, errorOverrides, SnackBarNotificationLevel.Error)
const error: HttpError = this.httpErrorHandlingService.getError(errorResponse);
if (error.statusCode === 302) {
this.router.navigate([this.routerUtils.generateUrl('home')]);

View File

@ -10,8 +10,8 @@ import { TranslateService } from '@ngx-translate/core';
import { takeUntil } from "rxjs/operators";
@Component({
selector: 'app-unlink-email-confirmation-component',
templateUrl: './unlink-email-confirmation.component.html'
selector: 'app-unlink-email-confirmation-component',
templateUrl: './unlink-email-confirmation.component.html'
})
export class UnlinkEmailConfirmation extends BaseComponent implements OnInit {
private token: Guid;
@ -50,11 +50,16 @@ export class UnlinkEmailConfirmation extends BaseComponent implements OnInit {
this.onCallbackConfirmationSuccess();
}
},
error => this.onCallbackError(error));
error => this.onCallbackError(error));
}
onCallbackConfirmationSuccess() {
this.router.navigate([this.routerUtils.generateUrl('home')]);
this.router.navigate([this.routerUtils.generateUrl('home')])
.then(() => {
localStorage.setItem('refreshPage', null);
localStorage.setItem('refreshPage', 'true');
window.location.reload();
});
}
onCallbackError(errorResponse: HttpErrorResponse) {
@ -63,7 +68,7 @@ export class UnlinkEmailConfirmation extends BaseComponent implements OnInit {
errorOverrides.set(302, this.language.instant('EMAIL-CONFIRMATION.EMAIL-FOUND'));
errorOverrides.set(-1, this.language.instant('EMAIL-CONFIRMATION.EXPIRED-EMAIL'));
this.httpErrorHandlingService.handleBackedRequestError(errorResponse, errorOverrides)
const error: HttpError = this.httpErrorHandlingService.getError(errorResponse);
if (error.statusCode === 302) {
this.router.navigate([this.routerUtils.generateUrl('home')]);