title: How to avoid repetition of .then() and .catch() after $http requests?
body: <p>I have a simple userAPI service in my angular app:</p>
  
  <pre><code>app.service('userAPI', function ($http) {
  this.create = function (user) {
      return $http
          .post("/api/user", { data: user })
          .then(function (promise) { return promise.data })
          .catch(function (error) { return error.data })
  }
  
  this.read = function (user) {
      return $http
          .get("/api/user/" + user.id)
          .then(function (promise) { return promise.data })
          .catch(function (error) { return error.data })
  }
  
  this.update = function (user) {
      return $http
          .patch("/api/user/" + user.id, { data: user })
          .then(function (promise) { return promise.data })
          .catch(function (error) { return error.data })
  }
  
  this.delete = function (user) {
      return $http
          .delete("/api/user/" + user.id)
          .then(function (promise) { return promise.data })
          .catch(function (error) { return error.data })
  }
  })
  </code></pre>
  
  <p>As you can see, i am repeating same .then() and .catch() functions after each of my $http requests. Ho can i avoid this repitition according to DRY principle?</p>