Removing one-off user adapter
This commit is contained in:
		
							parent
							
								
									a5f98bbe23
								
							
						
					
					
						commit
						503f24882a
					
				
					 1 changed files with 0 additions and 27 deletions
				
			
		| 
						 | 
				
			
			@ -1,27 +0,0 @@
 | 
			
		|||
import Ember from 'ember';
 | 
			
		||||
import DS from 'ember-data';
 | 
			
		||||
 | 
			
		||||
export default DS.RESTAdapter.extend({
 | 
			
		||||
  namespace: 'api',
 | 
			
		||||
  host: function() {
 | 
			
		||||
    return this.get('globals.apiURL');
 | 
			
		||||
  }.property(),
 | 
			
		||||
  coalesceFindRequests: true,
 | 
			
		||||
  ajaxError: function(jqXHR) {
 | 
			
		||||
    // http://stackoverflow.com/a/24027443
 | 
			
		||||
    var error = this._super(jqXHR);
 | 
			
		||||
    if (jqXHR && jqXHR.status === 422) {
 | 
			
		||||
      var response = Ember.$.parseJSON(jqXHR.responseText),
 | 
			
		||||
        errors = {};
 | 
			
		||||
      if (response.errors !== undefined) {
 | 
			
		||||
        var jsonErrors = response.errors;
 | 
			
		||||
        Ember.EnumerableUtils.forEach(Ember.keys(jsonErrors), function(key) {
 | 
			
		||||
          errors[Ember.String.camelize(key)] = jsonErrors[key];
 | 
			
		||||
        });
 | 
			
		||||
      }
 | 
			
		||||
      return new DS.InvalidError(errors);
 | 
			
		||||
    } else {
 | 
			
		||||
      return error;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
		Reference in a new issue