added handling login error to the get customers method

This commit is contained in:
Akash Shah 2019-06-10 00:46:09 -04:00
parent 4db470f7fc
commit c5081f6e38

View File

@ -73,8 +73,17 @@ export class AstuteClientService {
return this.http.get(url)
.toPromise()
.then(response => {
console.log(response['entity']);
return response['entity'];
const message = response['message'];
if (message === 'Success') {
console.log(response['entity']);
return response['entity'];
} else if (message.includes('login')) {
alert('Please login again!');
} else {
alert('Get Customers Failed: ' + message);
}
}, (reason) => {
alert('Get Customers Failed: ' + reason);
})
.catch( error => {
alert(error);