mirror of
https://github.com/dyiop/astute.git
synced 2025-04-06 21:30:20 -04:00
added handling login error to the get customers method
This commit is contained in:
parent
4db470f7fc
commit
c5081f6e38
|
@ -73,8 +73,17 @@ export class AstuteClientService {
|
||||||
return this.http.get(url)
|
return this.http.get(url)
|
||||||
.toPromise()
|
.toPromise()
|
||||||
.then(response => {
|
.then(response => {
|
||||||
console.log(response['entity']);
|
const message = response['message'];
|
||||||
return response['entity'];
|
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 => {
|
.catch( error => {
|
||||||
alert(error);
|
alert(error);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user