function ProductsController(service, popupService) {
  const vm = this;
  vm.products = [];

  vm.fetch = (url) => {
    const fetch = service.fetch(url);

    fetch.then((response) => {
      vm.products = response.data.products;
    });

    fetch.catch((error) => {
      popupService.show('Error', error.statusText + ': ' + error.status,
        'Close');
    });

    return fetch;
  };

  vm.fetch('/products.json');
}

//noinspection JSValidateTypes
ProductsController.$inject = ['service', 'popupService'];

export {ProductsController};

@@ -99,21 +99,19 @@
 fetch = 
-(
 url
-)
  =%3E %7B%0A  
@@ -116,21 +116,14 @@
     
-const fetch =
+return
  ser
@@ -137,28 +137,16 @@
 tch(url)
-;%0A%0A    fetch
 .then((r
@@ -213,20 +213,8 @@
   %7D)
-;%0A%0A    fetch
 .cat
@@ -332,61 +332,11 @@
 %7D);%0A
-%0A    return fetch;%0A  %7D;%0A%0A  vm.fetch('/products.json')
+  %7D
 ;%0A%7D%0A

repair unhandledpromiserejection warning