# Treat each kind of action accordingly tokenWrapper = (resource, action) -‐> resource['_' + action] = resource[action] ! if action in ['save', 'update'] resource[action] = (params, data, success, error) -‐> resource['_' + action] angular.extend({}, params or {}, username: authTokenHandler.getUsername() auth_token: authTokenHandler.getAuthToken() ), data, success, error else resource[action] = (params, success, error) -‐> resource["_" + action] angular.extend({}, params or {}, username: authTokenHandler.getUsername() auth_token: authTokenHandler.getAuthToken() ), success, error