Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
(fix) Proper error handling in HTTP requests
  • Loading branch information
chenkie committed Jan 8, 2016
commit 2eb9dc2b6c1276884dced8ad48000bb9c42b5d95
4 changes: 2 additions & 2 deletions src/home/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ export class Home {
this.http.get(url)
.subscribe(
response => this.response = response.text(),
error => this.response = error.json().message
error => this.response = error.text()
);
}
if (type === 'Secured') {
// For protected routes, use AuthHttp
this.authHttp.get(url)
.subscribe(
response => this.response = response.text(),
error => this.response = error.json().message
error => this.response = error.text()
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/login/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export class Login {
this.router.parent.navigateByUrl('/home');
},
error => {
alert(error.json().message);
console.log(error.json().message);
alert(error.text());
console.log(error.text());
}
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/signup/signup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export class Signup {
this.router.parent.navigateByUrl('/home');
},
error => {
alert(error.json().message);
console.log(error.json().message);
alert(error.text());
console.log(error.text());
}
);
}
Expand Down
4 changes: 4 additions & 0 deletions typings/_custom/webpack.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare var require: any;
declare var __filename: string;
declare var __dirname: string;
declare var global: any;
1 change: 0 additions & 1 deletion typings/tsd.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/// <reference path="_custom/custom.d.ts" />
/// <reference path="whatwg-fetch/whatwg-fetch.d.ts" />