summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/static_site_editor/store
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/static_site_editor/store')
-rw-r--r--app/assets/javascripts/static_site_editor/store/actions.js37
-rw-r--r--app/assets/javascripts/static_site_editor/store/getters.js2
-rw-r--r--app/assets/javascripts/static_site_editor/store/index.js19
-rw-r--r--app/assets/javascripts/static_site_editor/store/mutation_types.js8
-rw-r--r--app/assets/javascripts/static_site_editor/store/mutations.js36
-rw-r--r--app/assets/javascripts/static_site_editor/store/state.js23
6 files changed, 0 insertions, 125 deletions
diff --git a/app/assets/javascripts/static_site_editor/store/actions.js b/app/assets/javascripts/static_site_editor/store/actions.js
deleted file mode 100644
index 9f5e9e8c589..00000000000
--- a/app/assets/javascripts/static_site_editor/store/actions.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import createFlash from '~/flash';
-import { __ } from '~/locale';
-
-import * as mutationTypes from './mutation_types';
-import loadSourceContent from '~/static_site_editor/services/load_source_content';
-import submitContentChanges from '~/static_site_editor/services/submit_content_changes';
-
-export const loadContent = ({ commit, state: { sourcePath, projectId } }) => {
- commit(mutationTypes.LOAD_CONTENT);
-
- return loadSourceContent({ sourcePath, projectId })
- .then(data => commit(mutationTypes.RECEIVE_CONTENT_SUCCESS, data))
- .catch(() => {
- commit(mutationTypes.RECEIVE_CONTENT_ERROR);
- createFlash(__('An error ocurred while loading your content. Please try again.'));
- });
-};
-
-export const setContent = ({ commit }, content) => {
- commit(mutationTypes.SET_CONTENT, content);
-};
-
-export const submitChanges = ({ state: { projectId, content, sourcePath, username }, commit }) => {
- commit(mutationTypes.SUBMIT_CHANGES);
-
- return submitContentChanges({ content, projectId, sourcePath, username })
- .then(data => commit(mutationTypes.SUBMIT_CHANGES_SUCCESS, data))
- .catch(error => {
- commit(mutationTypes.SUBMIT_CHANGES_ERROR, error.message);
- });
-};
-
-export const dismissSubmitChangesError = ({ commit }) => {
- commit(mutationTypes.DISMISS_SUBMIT_CHANGES_ERROR);
-};
-
-export default () => {};
diff --git a/app/assets/javascripts/static_site_editor/store/getters.js b/app/assets/javascripts/static_site_editor/store/getters.js
deleted file mode 100644
index ebc68f8e9e6..00000000000
--- a/app/assets/javascripts/static_site_editor/store/getters.js
+++ /dev/null
@@ -1,2 +0,0 @@
-// eslint-disable-next-line import/prefer-default-export
-export const contentChanged = ({ originalContent, content }) => originalContent !== content;
diff --git a/app/assets/javascripts/static_site_editor/store/index.js b/app/assets/javascripts/static_site_editor/store/index.js
deleted file mode 100644
index 43256979ddd..00000000000
--- a/app/assets/javascripts/static_site_editor/store/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import Vuex from 'vuex';
-import Vue from 'vue';
-import createState from './state';
-import * as getters from './getters';
-import * as actions from './actions';
-import mutations from './mutations';
-
-Vue.use(Vuex);
-
-const createStore = ({ initialState } = {}) => {
- return new Vuex.Store({
- state: createState(initialState),
- getters,
- actions,
- mutations,
- });
-};
-
-export default createStore;
diff --git a/app/assets/javascripts/static_site_editor/store/mutation_types.js b/app/assets/javascripts/static_site_editor/store/mutation_types.js
deleted file mode 100644
index 9cf356aecc5..00000000000
--- a/app/assets/javascripts/static_site_editor/store/mutation_types.js
+++ /dev/null
@@ -1,8 +0,0 @@
-export const LOAD_CONTENT = 'loadContent';
-export const RECEIVE_CONTENT_SUCCESS = 'receiveContentSuccess';
-export const RECEIVE_CONTENT_ERROR = 'receiveContentError';
-export const SET_CONTENT = 'setContent';
-export const SUBMIT_CHANGES = 'submitChanges';
-export const SUBMIT_CHANGES_SUCCESS = 'submitChangesSuccess';
-export const SUBMIT_CHANGES_ERROR = 'submitChangesError';
-export const DISMISS_SUBMIT_CHANGES_ERROR = 'dismissSubmitChangesError';
diff --git a/app/assets/javascripts/static_site_editor/store/mutations.js b/app/assets/javascripts/static_site_editor/store/mutations.js
deleted file mode 100644
index 72fe71f1c9b..00000000000
--- a/app/assets/javascripts/static_site_editor/store/mutations.js
+++ /dev/null
@@ -1,36 +0,0 @@
-import * as types from './mutation_types';
-
-export default {
- [types.LOAD_CONTENT](state) {
- state.isLoadingContent = true;
- },
- [types.RECEIVE_CONTENT_SUCCESS](state, { title, content }) {
- state.isLoadingContent = false;
- state.isContentLoaded = true;
- state.title = title;
- state.content = content;
- state.originalContent = content;
- },
- [types.RECEIVE_CONTENT_ERROR](state) {
- state.isLoadingContent = false;
- },
- [types.SET_CONTENT](state, content) {
- state.content = content;
- },
- [types.SUBMIT_CHANGES](state) {
- state.isSavingChanges = true;
- state.submitChangesError = '';
- },
- [types.SUBMIT_CHANGES_SUCCESS](state, meta) {
- state.savedContentMeta = meta;
- state.isSavingChanges = false;
- state.originalContent = state.content;
- },
- [types.SUBMIT_CHANGES_ERROR](state, error) {
- state.submitChangesError = error;
- state.isSavingChanges = false;
- },
- [types.DISMISS_SUBMIT_CHANGES_ERROR](state) {
- state.submitChangesError = '';
- },
-};
diff --git a/app/assets/javascripts/static_site_editor/store/state.js b/app/assets/javascripts/static_site_editor/store/state.js
deleted file mode 100644
index 8c524b4ffe9..00000000000
--- a/app/assets/javascripts/static_site_editor/store/state.js
+++ /dev/null
@@ -1,23 +0,0 @@
-const createState = (initialState = {}) => ({
- username: null,
- projectId: null,
- returnUrl: null,
- sourcePath: null,
-
- isLoadingContent: false,
- isSavingChanges: false,
- isSupportedContent: false,
-
- isContentLoaded: false,
-
- originalContent: '',
- content: '',
- title: '',
-
- submitChangesError: '',
- savedContentMeta: null,
-
- ...initialState,
-});
-
-export default createState;