Skip to content

Commit c4c012f

Browse files
committed
Remove constants
1 parent 4a27973 commit c4c012f

File tree

3 files changed

+10
-23
lines changed

3 files changed

+10
-23
lines changed

generator/templates/Crud/src/components/Resource.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ export default {
146146
perPage: itemsPerPage,
147147
...sorting,
148148
})
149-
.then(res => {
150-
const items = this.mapDataResponse(res.data.data);
151-
const total = res.data.meta.total;
149+
.then(response => {
150+
const items = this.mapDataResponse(response.data.data);
151+
const total = response.data.meta.total;
152152
resolve({
153153
items,
154154
total,
@@ -160,7 +160,7 @@ export default {
160160
getItemFromApi(id) {
161161
return new Promise((resolve) => {
162162
axios.get((this.showResourceUri || this.resourceUri) + '/' + id)
163-
.then((response) => {
163+
.then(response => {
164164
const item = response.data.data;
165165
resolve({
166166
item,
@@ -183,10 +183,10 @@ export default {
183183
process.nextTick(() => {
184184
if (this.createForm.valid) {
185185
axios.post((this.createResourceUri || this.resourceUri), this.getCreateFormValues())
186-
.then(res => {
186+
.then(response => {
187187
this.createForm.values = {};
188188
if (typeof this.afterCreate === 'function') {
189-
this.afterCreate(res.data.data).then(() => {
189+
this.afterCreate(response.data.data).then(() => {
190190
resolve();
191191
});
192192
} else {

generator/templates/Default/src/store/constants.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

generator/templates/Default/src/store/modules/Error.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import {ADD, CLEAR, FIND, REMOVE} from '../constants.js';
2-
31
export default {
42
namespaced: true,
53
state: {
64
errors: [],
75
},
86
mutations: {
9-
[REMOVE]: (state, key) => state.errors.splice(state.errors.findIndex(x => x.key === key), 1),
10-
[CLEAR]: state => state.errors = [],
11-
[ADD]: (state, {message, key}) => {
7+
remove: (state, key) => state.errors.splice(state.errors.findIndex(x => x.key === key), 1),
8+
clear: state => state.errors = [],
9+
add: (state, {message, key}) => {
1210
const target = state.errors.find(x => x.key === key);
1311

1412
if (!target) {
@@ -22,7 +20,7 @@ export default {
2220
},
2321
},
2422
getters: {
25-
[FIND]: state => key => {
23+
find: state => key => {
2624
const error = state.errors.find(x => x.key === key);
2725

2826
if (error) return error.message;

0 commit comments

Comments
 (0)