cerebral-legacy / cerebral-module-http

HTTP module for Cerebral

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

readme: tell that action factories require Http module to be added

fvgoto opened this issue · comments

A bit too naively, I supposed that importing a http action factory in some signal or chain was enough to use it (... as is the case e.g. for cerebral-addons/set.)
But it rather needs the Http to be added as sub-(/dependent) module beforehand.
Indeed, if we want some axios options, it is logical to add them at Http instantiation.

Maybe it would be helpful to the beginner to mention the module requirement explicitly on the README page.

And why not adding a check and a useful message in the action factories?
Something of this kind:

   var http = args.modules['cerebral-module-http'];
+  if( ! http) {
+    throw "Http action factories require 'cerebral-module-http' module to be added to controller or current module";
+  }

Yeah, this is really good feedback! I completely agree :)

I am working on the new Cerebral update currently, but if you want to create a pull for this as well you are very welcome :)

Fixed by merged PR #11.