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 ability to import the constants of the action-types #90

Open
ondrasak opened this issue May 17, 2017 · 6 comments
Open

Add ability to import the constants of the action-types #90

ondrasak opened this issue May 17, 2017 · 6 comments

Comments

@ondrasak
Copy link

Would be great to have ability to import the constants of the action-types .

Use case:
I want to listen on some action and perform side-effect
now I need to hardcode the name of the action

@hally9k
Copy link
Collaborator

hally9k commented May 17, 2017

@ondrasak I'm not sure that I fully understand your proposal. Could explain it in a bit more detail?

@ondrasak
Copy link
Author

let say I want the behaviour:
When route/state is changed -> close side navigation

so in some redux-middleware (i my case redux-observable) -> I will check all action if their type is equal to '@@reduxUiRouter/$stateChangeStart' -> if YES then perform desired action

so I need to get somehow the string "@@reduxUiRouter/$stateChangeStart"

would be great to have ability to import that constant

import {STATE_CHANGE_START} from "redux-ui-router"
// or
import {actionTypes} from "redux-ui-router" // -> actionTypes.STATE_CHANGE_START

@hally9k
Copy link
Collaborator

hally9k commented May 20, 2017

I understand now. As opposed to maintaining those constants externally. I may get round to this in a week or so but open to a PR in the meantime 👍

@skortchmark9
Copy link

skortchmark9 commented Sep 29, 2017

Yes, agreed I currently have to redefine the ui router action types in my app.

@skortchmark9
Copy link

skortchmark9 commented Oct 12, 2017

Actually, a slightly more stable hack than defining them yourselves is to use the action creators:

const STATE_GO = stateGo().type

@skortchmark9
Copy link

Incidentally, you might want to change your namespacing - it breaks https://github.com/wix/redux-saga-tester/blob/master/src/SagaTester.js#L45

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

3 participants