about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/actions/push_notifications/setter.js
diff options
context:
space:
mode:
authorbeatrix <beatrix.bitrot@gmail.com>2018-01-05 18:29:57 -0500
committerGitHub <noreply@github.com>2018-01-05 18:29:57 -0500
commitf441770e50621ac59a7b022ee2127964935b2b8d (patch)
treebd7bca6f161424f2fa6c6595fe70bb2d7df1074f /app/javascript/flavours/glitch/actions/push_notifications/setter.js
parentb4e667f86b645a1ddaa7944b61c2d6ca3b9e3981 (diff)
parent72b99f6ee416888ad4ea041c4cf90390c75e6861 (diff)
Merge pull request #290 from chriswmartin/web-push-updates
Web push updates
Diffstat (limited to 'app/javascript/flavours/glitch/actions/push_notifications/setter.js')
-rw-r--r--app/javascript/flavours/glitch/actions/push_notifications/setter.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/actions/push_notifications/setter.js b/app/javascript/flavours/glitch/actions/push_notifications/setter.js
new file mode 100644
index 000000000..a2cc41c5a
--- /dev/null
+++ b/app/javascript/flavours/glitch/actions/push_notifications/setter.js
@@ -0,0 +1,34 @@
+export const SET_BROWSER_SUPPORT = 'PUSH_NOTIFICATIONS_SET_BROWSER_SUPPORT';
+export const SET_SUBSCRIPTION = 'PUSH_NOTIFICATIONS_SET_SUBSCRIPTION';
+export const CLEAR_SUBSCRIPTION = 'PUSH_NOTIFICATIONS_CLEAR_SUBSCRIPTION';
+export const SET_ALERTS = 'PUSH_NOTIFICATIONS_SET_ALERTS';
+
+export function setBrowserSupport (value) {
+  return {
+    type: SET_BROWSER_SUPPORT,
+    value,
+  };
+}
+
+export function setSubscription (subscription) {
+  return {
+    type: SET_SUBSCRIPTION,
+    subscription,
+  };
+}
+
+export function clearSubscription () {
+  return {
+    type: CLEAR_SUBSCRIPTION,
+  };
+}
+
+export function setAlerts (key, value) {
+  return dispatch => {
+    dispatch({
+      type: SET_ALERTS,
+      key,
+      value,
+    });
+  };
+}