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

Create UserStateResponse #50

Closed
ro31337 opened this issue May 26, 2016 · 0 comments
Closed

Create UserStateResponse #50

ro31337 opened this issue May 26, 2016 · 0 comments

Comments

@ro31337
Copy link
Owner

ro31337 commented May 26, 2016

UserStateResponse is type of Response with the type user-state, and will be used to tell the handler to update (current) user's state. Constructor accepts hash of properties to be set.

For example, SelectLanguage action can return this response, and user.state.locale will be set to en. The code of SelectLanguage.execute method may look like:

// ...
return new UserStateResponse({ locale: 'en' });

However, the code above is not a good practice. UserStateResponse is the base class for all state operations. For example, the line above can be rewritten to:

return new SelectLanguageResponse('en');

And SelectLanguageResponse extends UserStateResponse:

class SelectLanguageResponse extends UserStateResponse ...
@ro31337 ro31337 closed this as completed May 27, 2016
@ro31337 ro31337 changed the title Create UpdateUserStateResponse Create UserStateResponse May 30, 2016
@ro31337 ro31337 reopened this May 31, 2016
ro31337 pushed a commit that referenced this issue Jun 17, 2016
ro31337 added a commit that referenced this issue Jun 17, 2016
@ro31337 ro31337 closed this as completed Jun 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant