about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/util/redux_helpers.js
diff options
context:
space:
mode:
authorbeatrix <beatrix.bitrot@gmail.com>2018-01-05 18:29:08 -0500
committerGitHub <noreply@github.com>2018-01-05 18:29:08 -0500
commitfaf20eeaa4c6f48a97a41a948ed29e734c8c4f5e (patch)
treeda0b88781650d514c209641fc6af7cbb921afe0b /app/javascript/flavours/glitch/util/redux_helpers.js
parentf41b33eb0177b23bd72fede7df94af43da0c7c6b (diff)
parentd7ce339c2e33a5607c21d3eff316669cff9c6ea3 (diff)
Merge pull request #293 from glitch-soc/compose-refactor
Compose refactor
Diffstat (limited to 'app/javascript/flavours/glitch/util/redux_helpers.js')
-rw-r--r--app/javascript/flavours/glitch/util/redux_helpers.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/util/redux_helpers.js b/app/javascript/flavours/glitch/util/redux_helpers.js
new file mode 100644
index 000000000..8eb338da7
--- /dev/null
+++ b/app/javascript/flavours/glitch/util/redux_helpers.js
@@ -0,0 +1,8 @@
+import { injectIntl } from 'react-intl';
+import { connect } from 'react-redux';
+
+//  Connects a component.
+export function wrap (Component, mapStateToProps, mapDispatchToProps, options) {
+  const withIntl = typeof options === 'object' ? options.withIntl : !!options;
+  return (withIntl ? injectIntl : i => i)(connect(mapStateToProps, mapDispatchToProps)(Component));
+}