Skip to content
Advertisement

Getting error Effect “n.loadInfo$” dispatched an invalid action

I am trying to write an effect for an action but it is throwing an error as: Effect “n.loadInfo$” dispatched an invalid action: null Error

I have my effect as below:

JavaScript

I have my action defined as below:

JavaScript

And in the service as below:

JavaScript

I have selector as below that is used in the effect:

JavaScript

Create reducer as below after the comment:

JavaScript

I would really appreciate if anyone can help on it. Thank you!

Advertisement

Answer

Your effect is trying to dispatch the result of this.infoService.loadINFO(), which is why you get the error saying that it is not a valid action.

You should map this to a success action instead:

JavaScript

You will also need to add the corresponding action and handle it in your reducer, if necessary.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement