no message
This commit is contained in:
parent
f985d467d0
commit
00a1f80f01
|
@ -67,7 +67,7 @@
|
|||
<mat-progress-bar [style.height.px]="2" *ngIf="filteringResearchersAsync" mode="indeterminate"></mat-progress-bar>
|
||||
</td-chips>
|
||||
|
||||
<mat-list *ngIf="associatedUsers.length" role="list">
|
||||
<mat-list *ngIf="associatedUsers?.length" role="list">
|
||||
<h3 mat-subheader>Associated Users</h3>
|
||||
<mat-list-item role="listitem" *ngFor="let user of associatedUsers">
|
||||
<mat-icon mat-list-icon>person</mat-icon>
|
||||
|
|
|
@ -7,7 +7,7 @@ import { User } from '../models/invitation/User';
|
|||
import { Component, OnInit, Inject } from "@angular/core";
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { Params, ActivatedRoute, Router } from '@angular/router';
|
||||
import { MAT_DIALOG_DATA } from '@angular/material';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
|
||||
|
||||
@Component({
|
||||
selector: 'app-invitation-component',
|
||||
|
@ -27,6 +27,7 @@ export class InvitationComponent implements OnInit {
|
|||
private invitationService: InvitationService,
|
||||
private route: ActivatedRoute,
|
||||
public router: Router,
|
||||
public dialogRef: MatDialogRef<InvitationComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) { }
|
||||
|
||||
|
@ -38,7 +39,9 @@ export class InvitationComponent implements OnInit {
|
|||
|
||||
|
||||
send(value: any) {
|
||||
this.invitationService.inviteUsers(this.formGroup.value).subscribe();
|
||||
this.invitationService.inviteUsers(this.formGroup.value).subscribe(
|
||||
null,null,()=>this.dialogRef.close()
|
||||
);
|
||||
}
|
||||
|
||||
filterUsers(value: string): void {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { Message } from '@angular/compiler/src/i18n/i18n_ast';
|
||||
import { ApiMessageCode } from '../types/ApiMessageCode';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Http, RequestOptions, Response, Headers } from '@angular/http';
|
||||
|
@ -80,11 +81,27 @@ export class BaseHttpService {
|
|||
//this.notification.httpError(error);
|
||||
return Observable.of<T>();
|
||||
} else {
|
||||
return Observable.throw(errorResponse);
|
||||
let error:any = errorResponse.error
|
||||
if(error.statusCode == ApiMessageCode.ERROR_MESSAGE){
|
||||
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
||||
data: { message: error.message, language: null },
|
||||
duration: 3000,
|
||||
extraClasses: ['snackbar-warning']
|
||||
})
|
||||
return Observable.throw(errorResponse);
|
||||
}
|
||||
else{
|
||||
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
||||
data: { message: 'GENERAL.ERRORS.HTTP-REQUEST-ERROR', language: this.language },
|
||||
duration: 3000,
|
||||
extraClasses: ['snackbar-warning']
|
||||
})
|
||||
return Observable.throw(errorResponse);
|
||||
}
|
||||
}
|
||||
})
|
||||
.map(response => {
|
||||
if (response.statusCode = ApiMessageCode.SUCCESS_MESSAGE) {
|
||||
if (response.statusCode == ApiMessageCode.SUCCESS_MESSAGE) {
|
||||
//throw new Error('Request failed');
|
||||
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
||||
data: { message: response.message, language: null },
|
||||
|
@ -94,7 +111,10 @@ export class BaseHttpService {
|
|||
return response.payload;
|
||||
|
||||
}
|
||||
else {
|
||||
else if(response.statusCode == ApiMessageCode.NO_MESSAGE){
|
||||
return response.payload;
|
||||
}
|
||||
else{
|
||||
return response.payload;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
"SUCCESSFUL-LOGOUT": "Successful Logout",
|
||||
"UNSUCCESSFUL-LOGOUT": "Unsuccessful Logout",
|
||||
"UNSUCCESSFUL-LOGIN": "Unsuccessful Login"
|
||||
},
|
||||
"ERROR":{
|
||||
"HTTP-REQUEST-ERROR":"AN Unexpected Error Has Occured"
|
||||
}
|
||||
},
|
||||
"NAV-BAR": {
|
||||
|
|
Loading…
Reference in New Issue