Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. getRestaurants(): Promise<_Restaurant[]> {
  2. return this.get("/restaurants").toPromise();
  3. };
  4.  
  5. loadRestaurants = async () => {
  6. try {
  7. this.restaurants = await this.restaurantService.getRestaurants();
  8. } catch (exception) {
  9. console.log(JSON.stringify(exception, null, 2));
  10. }
  11. }
  12.  
  13. async getRestaurants(): Promise<_Restaurant[]> {
  14. try {
  15. const response: _Restaurant[] = await this.get("/restaurants").toPromise() as _Restaurant[];
  16. return response;
  17. } catch (exception) {
  18. throw new Error(exception);
  19. }
  20. };
  21.  
  22. loadRestaurants = async () => {
  23. try {
  24. this.restaurants = await this.restaurantService.getRestaurants();
  25. } catch (exception) {
  26. console.log(JSON.stringify(exception, null, 2));
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement