Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getToken() and setToken() methods instead of class getter/setter #26

Closed
joaogranado opened this issue Mar 22, 2015 · 0 comments · Fixed by #28
Closed

Add getToken() and setToken() methods instead of class getter/setter #26

joaogranado opened this issue Mar 22, 2015 · 0 comments · Fixed by #28

Comments

@joaogranado
Copy link
Member

I think we should remove getters/setters aproach and add methods to expose/manipulate token on OAuthToken service. I think it should be the class concern to have access to the property so that the property should be updated by the container object as a side-effect of other actions. Another point I noticed with #19, is that is quite complicated to override the getters and setters using a decorator for example. I should be as easy/quick as:

function oauthConfig($provide) {
  $provide.decorator('OAuthToken', function($delegate) {
    $delegate.prototype.getToken = function() {
      // your code here...
    };

    $delegate.prototype.setToken = function() {
      // your code here...
    };

    return $delegate;
  });
}

NOTE: This won't change the service usage, and can't be considered a breaking change since these are almost private methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant