Skip to content

Commit 338d2dc

Browse files
committed
Added mutation-types
1 parent cf27239 commit 338d2dc

File tree

7 files changed

+73
-31
lines changed

7 files changed

+73
-31
lines changed

src/generators/VueCrudGenerator.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default class VueCrudGenerator {
1919
this.registerTemplate(templatePath, 'store/modules/foo/list.js');
2020
this.registerTemplate(templatePath, 'store/modules/foo/update.js');
2121
this.registerTemplate(templatePath, 'store/modules/foo/show.js');
22+
this.registerTemplate(templatePath, 'store/modules/foo/mutation-types.js');
2223

2324
// api
2425
this.registerTemplate(templatePath, 'api/fooFetch.js');
@@ -106,6 +107,7 @@ const router = new VueRouter({
106107
this.createFile('store/modules/foo/list.js', `${dir}/store/modules/${lc}/list.js`, context);
107108
this.createFile('store/modules/foo/update.js', `${dir}/store/modules/${lc}/update.js`, context);
108109
this.createFile('store/modules/foo/show.js', `${dir}/store/modules/${lc}/show.js`, context);
110+
this.createFile('store/modules/foo/mutation-types.js', `${dir}/store/modules/${lc}/mutation-types.js`, context);
109111

110112
// api
111113
this.createFile('api/fooFetch.js', `${dir}/api/${lc}Fetch.js`, context);

templates/vue/store/modules/foo/create.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import {{{ lc }}}Fetch from '../../../api/{{{ lc }}}Fetch';
2-
3-
const {{{ uc }}}_CREATE_ERROR = '{{{ uc }}}_CREATE_ERROR';
4-
const {{{ uc }}}_CREATE_LOADING = '{{{ uc }}}_CREATE_LOADING';
5-
const {{{ uc }}}_CREATE_SUCCESS = '{{{ uc }}}_CREATE_SUCCESS';
6-
const {{{ uc }}}_CREATE_VIOLATIONS = '{{{ uc }}}_CREATE_VIOLATIONS';
7-
const {{{ uc }}}_CREATE_RESET = '{{{ uc }}}_CREATE_RESET';
2+
import {
3+
{{{ uc }}}_CREATE_ERROR,
4+
{{{ uc }}}_CREATE_LOADING,
5+
{{{ uc }}}_CREATE_SUCCESS,
6+
{{{ uc }}}_CREATE_VIOLATIONS,
7+
{{{ uc }}}_CREATE_RESET
8+
} from './mutation-types';
89

910
const state = {
1011
loading: false,

templates/vue/store/modules/foo/delete.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import {{{ lc }}}Fetch from '../../../api/{{{ lc }}}Fetch';
2-
3-
const {{{ uc }}}_DELETE_ERROR = '{{{ uc }}}_DELETE_ERROR';
4-
const {{{ uc }}}_DELETE_LOADING = '{{{ uc }}}_DELETE_LOADING';
5-
const {{{ uc }}}_DELETE_SUCCESS = '{{{ uc }}}_DELETE_SUCCESS';
6-
const {{{ uc }}}_DELETE_RESET = '{{{ uc }}}_DELETE_RESET';
2+
import {
3+
{{{ uc }}}_DELETE_ERROR,
4+
{{{ uc }}}_DELETE_LOADING,
5+
{{{ uc }}}_DELETE_SUCCESS,
6+
{{{ uc }}}_DELETE_RESET
7+
} from './mutation-types';
78

89
const state = {
910
loading: false,

templates/vue/store/modules/foo/list.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import {{{ lc }}}Fetch from '../../../api/{{{ lc }}}Fetch';
2-
3-
const {{{ uc }}}_LIST_ERROR = '{{{ uc }}}_LIST_ERROR';
4-
const {{{ uc }}}_LIST_LOADING = '{{{ uc }}}_LIST_LOADING';
5-
const {{{ uc }}}_LIST_RESET = '{{{ uc }}}_LIST_RESET';
6-
const {{{ uc }}}_LIST_VIEW = '{{{ uc }}}_LIST_VIEW';
7-
const {{{ uc }}}_LIST_SUCCESS = '{{{ uc }}}_LIST_SUCCESS';
2+
import {
3+
{{{ uc }}}_LIST_ERROR,
4+
{{{ uc }}}_LIST_LOADING,
5+
{{{ uc }}}_LIST_RESET,
6+
{{{ uc }}}_LIST_VIEW,
7+
{{{ uc }}}_LIST_SUCCESS
8+
} from './mutation-types';
89

910
const state = {
1011
loading: false,
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Create types
2+
export const {{{ uc }}}_CREATE_ERROR = '{{{ uc }}}_CREATE_ERROR';
3+
export const {{{ uc }}}_CREATE_LOADING = '{{{ uc }}}_CREATE_LOADING';
4+
export const {{{ uc }}}_CREATE_SUCCESS = '{{{ uc }}}_CREATE_SUCCESS';
5+
export const {{{ uc }}}_CREATE_VIOLATIONS = '{{{ uc }}}_CREATE_VIOLATIONS';
6+
export const {{{ uc }}}_CREATE_RESET = '{{{ uc }}}_CREATE_RESET';
7+
8+
// Show types
9+
export const {{{ uc }}}_SHOW_ERROR = '{{{ uc }}}_SHOW_ERROR';
10+
export const {{{ uc }}}_SHOW_LOADING = '{{{ uc }}}_SHOW_LOADING';
11+
export const {{{ uc }}}_SHOW_RETRIEVED_SUCCESS = '{{{ uc }}}_SHOW_RETRIEVED_SUCCESS';
12+
export const {{{ uc }}}_SHOW_RESET = '{{{ uc }}}_SHOW_RESET';
13+
14+
// Update types
15+
export const {{{ uc }}}_UPDATE_RESET = '{{{ uc }}}_UPDATE_RESET';
16+
export const {{{ uc }}}_UPDATE_UPDATE_ERROR = '{{{ uc }}}_UPDATE_UPDATE_ERROR';
17+
export const {{{ uc }}}_UPDATE_UPDATE_LOADING = '{{{ uc }}}_UPDATE_UPDATE_LOADING';
18+
export const {{{ uc }}}_UPDATE_UPDATE_SUCCESS = '{{{ uc }}}_UPDATE_UPDATE_SUCCESS';
19+
export const {{{ uc }}}_UPDATE_RETRIEVE_ERROR = '{{{ uc }}}_UPDATE_RETRIEVE_ERROR';
20+
export const {{{ uc }}}_UPDATE_RETRIEVE_LOADING = '{{{ uc }}}_UPDATE_RETRIEVE_LOADING';
21+
export const {{{ uc }}}_UPDATE_RETRIEVE_SUCCESS = '{{{ uc }}}_UPDATE_RETRIEVE_SUCCESS';
22+
export const {{{ uc }}}_UPDATE_UPDATE_VIOLATIONS = '{{{ uc }}}_UPDATE_UPDATE_VIOLATIONS';
23+
24+
// Delete types
25+
export const {{{ uc }}}_DELETE_ERROR = '{{{ uc }}}_DELETE_ERROR';
26+
export const {{{ uc }}}_DELETE_LOADING = '{{{ uc }}}_DELETE_LOADING';
27+
export const {{{ uc }}}_DELETE_SUCCESS = '{{{ uc }}}_DELETE_SUCCESS';
28+
export const {{{ uc }}}_DELETE_RESET = '{{{ uc }}}_DELETE_RESET';
29+
30+
// List types
31+
export const {{{ uc }}}_LIST_ERROR = '{{{ uc }}}_LIST_ERROR';
32+
export const {{{ uc }}}_LIST_LOADING = '{{{ uc }}}_LIST_LOADING';
33+
export const {{{ uc }}}_LIST_RESET = '{{{ uc }}}_LIST_RESET';
34+
export const {{{ uc }}}_LIST_VIEW = '{{{ uc }}}_LIST_VIEW';
35+
export const {{{ uc }}}_LIST_SUCCESS = '{{{ uc }}}_LIST_SUCCESS';

templates/vue/store/modules/foo/show.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import {{{ lc }}}Fetch from '../../../api/{{{ lc }}}Fetch';
2-
3-
const {{{ uc }}}_SHOW_ERROR = '{{{ uc }}}_SHOW_ERROR';
4-
const {{{ uc }}}_SHOW_LOADING = '{{{ uc }}}_SHOW_LOADING';
5-
const {{{ uc }}}_SHOW_RETRIEVED_SUCCESS = '{{{ uc }}}_SHOW_RETRIEVED_SUCCESS';
6-
const {{{ uc }}}_SHOW_RESET = '{{{ uc }}}_SHOW_RESET';
2+
import {
3+
{{{ uc }}}_SHOW_ERROR,
4+
{{{ uc }}}_SHOW_LOADING,
5+
{{{ uc }}}_SHOW_RETRIEVED_SUCCESS,
6+
{{{ uc }}}_SHOW_RESET
7+
} from './mutation-types';
78

89
const state = {
910
loading: false,

templates/vue/store/modules/foo/update.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import SubmissionError from '../../../error/SubmissionError';
22
import {{{ lc }}}Fetch from '../../../api/{{{ lc }}}Fetch';
3-
4-
const {{{ uc }}}_UPDATE_RESET = '{{{ uc }}}_UPDATE_RESET';
5-
const {{{ uc }}}_UPDATE_UPDATE_ERROR = '{{{ uc }}}_UPDATE_UPDATE_ERROR';
6-
const {{{ uc }}}_UPDATE_UPDATE_LOADING = '{{{ uc }}}_UPDATE_UPDATE_LOADING';
7-
const {{{ uc }}}_UPDATE_UPDATE_SUCCESS = '{{{ uc }}}_UPDATE_UPDATE_SUCCESS';
8-
const {{{ uc }}}_UPDATE_RETRIEVE_ERROR = '{{{ uc }}}_UPDATE_RETRIEVE_ERROR';
9-
const {{{ uc }}}_UPDATE_RETRIEVE_LOADING = '{{{ uc }}}_UPDATE_RETRIEVE_LOADING';
10-
const {{{ uc }}}_UPDATE_RETRIEVE_SUCCESS = '{{{ uc }}}_UPDATE_RETRIEVE_SUCCESS';
11-
const {{{ uc }}}_UPDATE_UPDATE_VIOLATIONS = '{{{ uc }}}_UPDATE_UPDATE_VIOLATIONS';
3+
import {
4+
{{{ uc }}}_UPDATE_RESET,
5+
{{{ uc }}}_UPDATE_UPDATE_ERROR,
6+
{{{ uc }}}_UPDATE_UPDATE_LOADING,
7+
{{{ uc }}}_UPDATE_UPDATE_SUCCESS,
8+
{{{ uc }}}_UPDATE_RETRIEVE_ERROR,
9+
{{{ uc }}}_UPDATE_RETRIEVE_LOADING,
10+
{{{ uc }}}_UPDATE_RETRIEVE_SUCCESS,
11+
{{{ uc }}}_UPDATE_UPDATE_VIOLATIONS
12+
} from './mutation-types';
1213

1314
const state = {
1415
loading: false,

0 commit comments

Comments
 (0)