Skip to content

Commit

Permalink
Исправление ошибок, рефакторинг
Browse files Browse the repository at this point in the history
  • Loading branch information
fgbm committed Mar 2, 2020
1 parent 3751206 commit c405d26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Vuex from 'vuex';
import vietify_drf_forms_store from './plugins/vuex';
import vietify_drf_forms_store from './store/vuetify-drf-forms';

import CForm from './components/CForm';
import CField from './components/CField';
Expand All @@ -23,7 +23,7 @@ const install = (Vue, options = {}) => {
let {store} = options;
if (store) {
// если передали store - регистрируем в нем свой модуль
store.registerModule(PLUGIN_NAME, vietify_drf_forms_store);
store.registerModule(PLUGIN_NAME, vietify_drf_forms_store, {preserveState: false});
} else {
// не передали, для начала проверим, установлен ли Vuex в Vue
if (!new Vue({store: {}}).$store) {
Expand Down
3 changes: 3 additions & 0 deletions src/store/vuetify-drf-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function checkEndpoint(state, endpoint) {
}
}

// noinspection JSUnusedGlobalSymbols
const mutations = {
setRecordField(state, {endpoint, field, value}) {
checkEndpoint(state, endpoint);
Expand Down Expand Up @@ -71,6 +72,7 @@ const mutations = {
}
};

// noinspection JSUnusedGlobalSymbols
const getters = {
getVuetifyField: (state) => ({endpoint, field}) => {
let props = {};
Expand Down Expand Up @@ -141,6 +143,7 @@ const getters = {
}
};

// noinspection JSUnusedGlobalSymbols
const actions = {
fetchRecordById({commit}, {endpoint, id}) {
this.$axios.get(`${endpoint}${id}/`).then((json) => {
Expand Down

0 comments on commit c405d26

Please sign in to comment.