summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/whats_new/store
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/whats_new/store')
-rw-r--r--app/assets/javascripts/whats_new/store/actions.js12
-rw-r--r--app/assets/javascripts/whats_new/store/mutation_types.js1
-rw-r--r--app/assets/javascripts/whats_new/store/mutations.js3
-rw-r--r--app/assets/javascripts/whats_new/store/state.js1
4 files changed, 16 insertions, 1 deletions
diff --git a/app/assets/javascripts/whats_new/store/actions.js b/app/assets/javascripts/whats_new/store/actions.js
index 53488413d9e..a84dfb399d8 100644
--- a/app/assets/javascripts/whats_new/store/actions.js
+++ b/app/assets/javascripts/whats_new/store/actions.js
@@ -1,10 +1,20 @@
import * as types from './mutation_types';
+import axios from '~/lib/utils/axios_utils';
export default {
closeDrawer({ commit }) {
commit(types.CLOSE_DRAWER);
},
- openDrawer({ commit }) {
+ openDrawer({ commit }, storageKey) {
commit(types.OPEN_DRAWER);
+
+ if (storageKey) {
+ localStorage.setItem(storageKey, JSON.stringify(false));
+ }
+ },
+ fetchItems({ commit }) {
+ return axios.get('/-/whats_new').then(({ data }) => {
+ commit(types.SET_FEATURES, data);
+ });
},
};
diff --git a/app/assets/javascripts/whats_new/store/mutation_types.js b/app/assets/javascripts/whats_new/store/mutation_types.js
index daa65230101..124d33a88b1 100644
--- a/app/assets/javascripts/whats_new/store/mutation_types.js
+++ b/app/assets/javascripts/whats_new/store/mutation_types.js
@@ -1,2 +1,3 @@
export const CLOSE_DRAWER = 'CLOSE_DRAWER';
export const OPEN_DRAWER = 'OPEN_DRAWER';
+export const SET_FEATURES = 'SET_FEATURES';
diff --git a/app/assets/javascripts/whats_new/store/mutations.js b/app/assets/javascripts/whats_new/store/mutations.js
index f7e84ee81a9..4fb7b17244e 100644
--- a/app/assets/javascripts/whats_new/store/mutations.js
+++ b/app/assets/javascripts/whats_new/store/mutations.js
@@ -7,4 +7,7 @@ export default {
[types.OPEN_DRAWER](state) {
state.open = true;
},
+ [types.SET_FEATURES](state, data) {
+ state.features = data;
+ },
};
diff --git a/app/assets/javascripts/whats_new/store/state.js b/app/assets/javascripts/whats_new/store/state.js
index 97089a095f1..4c76284b865 100644
--- a/app/assets/javascripts/whats_new/store/state.js
+++ b/app/assets/javascripts/whats_new/store/state.js
@@ -1,3 +1,4 @@
export default {
open: false,
+ features: null,
};