Skip to content

Commit be15135

Browse files
committed
refactor: create-cli
1 parent 9cef1c4 commit be15135

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

create/templates/module/services/exampleService.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ export default class ExampleService {
66
/**
77
* @param {Http} http
88
*/
9-
public constructor(http: Http) {
9+
public constructor (http: Http) {
1010
this.http = http
1111
}
1212

1313
/**
1414
* @param {string} url
1515
* @param {{}} params?
1616
* @param {{}} config?
17+
* @returns Promise
1718
*/
18-
public async get(url: string, params?: {}, config?: {}) {
19+
public async get (url: string, params?: {}, config?: {}): Promise<any> {
1920
try {
2021
return await this.http.get(url, params, config)
2122
} catch (error) {

create/templates/module/stores/exampleActions.ts

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { API_EXAMPLE } from '../../constants'
33
import { exampleService } from '../../services'
44

55
const actions: {[key: string]: Function} = {
6+
/**
7+
* @param {{commit:Function}} {commit}
8+
*/
69
[types.EXAMPLE_REQUEST]: async ({ commit }: { commit: Function }) => {
710
commit(types.EXAMPLE_REQUEST)
811

create/templates/module/stores/exampleGetters.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { ExampleState } from '../../typings/exampleTypings'
22

33
const getters: {[key: string]: Function} = {
4+
/**
5+
* @param {ExampleState} state
6+
*/
47
example: (state: ExampleState) => state
58
}
69

create/templates/module/stores/exampleMutations.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
import * as types from './exampleTypes'
2-
import {
2+
import {
33
ExampleState,
44
ExampleDataModel
55
} from '../../typings/exampleTypings'
66

77
const mutations: {[key: string]: Function} = {
8+
/**
9+
* @param {ExampleState} state
10+
*/
811
[types.EXAMPLE_REQUEST]: (state: ExampleState) => {
912
state.isFetching = true
1013
state.isError = false
1114
},
1215

16+
/**
17+
* @param {ExampleState} state
18+
* @param {ExampleDataModel[]} response
19+
*/
1320
[types.EXAMPLE_SUCCESS]: (state: ExampleState, response: ExampleDataModel[]) => {
1421
state.data = response
1522
state.isFetching = false
1623
},
1724

25+
/**
26+
* @param {ExampleState} state
27+
* @param {boolean} response
28+
*/
1829
[types.EXAMPLE_ERROR]: (state: ExampleState, response: boolean) => {
1930
state.isFetching = false
2031
state.isError = response

0 commit comments

Comments
 (0)