File tree 6 files changed +55
-1
lines changed 6 files changed +55
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,13 @@ A Vue project template with [Loopback](http://loopback.io/) framework featuring
20
20
3 . ` server ` : Loopback server files
21
21
4 . ` test ` : Unit test
22
22
23
+ ## Features
24
+
25
+ * Loopback service using [ axios] ( https://github.com/axios/axios ) at ` client/services/loopback ` ;
26
+ * Full authentication support, by default the account listed in ` server/initial-data/maintenance-account.json ` is created;
27
+ * Ajax Async queue module in ` client/modules/async ` (useful to see if and how many requests are being made to the server);
28
+ * [ CSS Modules] ( https://github.com/css-modules/css-modules ) , [ Sass] ( https://sass-lang.com/ ) and [ Bootstrap Vue] ( https://bootstrap-vue.js.org ) .
29
+
23
30
## Linting
24
31
25
32
```
Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ export default {
13
13
hello: ' Hello World!' ,
14
14
}),
15
15
{{/ unless}}
16
+ created () {
17
+ // Boot Application
18
+ this .$store .dispatch (' async/syncLoopback' );
19
+ }
16
20
}
17
21
</script >
18
22
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ function addTokenFromLocalStorage(http) {
28
28
29
29
const http = axios . create ( {
30
30
baseURL : `http://${ host } :${ port } ${ restApiRoot } ` ,
31
- } ) ; fi
31
+ } ) ;
32
32
33
33
// Current setLoading function
34
34
let setLoading = ( ) => {
Original file line number Diff line number Diff line change 1
1
import Vue from 'vue' ;
2
2
import Vuex from 'vuex' ;
3
3
4
+ import async from './modules/async' ;
4
5
import auth from './modules/auth' ;
5
6
6
7
Vue . use ( Vuex ) ;
@@ -16,6 +17,7 @@ export default new Vuex.Store({
16
17
} ] ,
17
18
} ,
18
19
modules : {
20
+ async, // async namespaced
19
21
auth, // auth namespaced
20
22
} ,
21
23
} ) ;
Original file line number Diff line number Diff line change
1
+ import getUID from 'uid' ;
2
+ import lb from '@/services/loopback' ;
3
+
4
+ export default {
5
+ namespaced : true ,
6
+ state : {
7
+ ajaxCommands : [ ] ,
8
+ } ,
9
+ getters : {
10
+ loadingAjax ( state ) {
11
+ if ( state . ajaxCommands . length > 0 ) return true ;
12
+ return false ;
13
+ } ,
14
+ } ,
15
+ actions : {
16
+ syncLoopback ( { commit} ) {
17
+ lb . setLoadingFunction (
18
+ ( isLoading , uid = getUID ( ) ) => {
19
+ if ( isLoading ) {
20
+ commit ( 'addAjaxCommand' , uid ) ;
21
+ } else {
22
+ commit ( 'removeAjaxCommand' , uid ) ;
23
+ }
24
+ return uid ;
25
+ }
26
+ ) ;
27
+ } ,
28
+ } ,
29
+ mutations : {
30
+ addAjaxCommand ( state , uid ) {
31
+ state . ajaxCommands . push ( uid ) ;
32
+ } ,
33
+ removeAjaxCommand ( state , uid ) {
34
+ state . ajaxCommands . splice (
35
+ state . ajaxCommands . indexOf ( uid ) ,
36
+ 1
37
+ ) ;
38
+ } ,
39
+ } ,
40
+ } ;
Original file line number Diff line number Diff line change 37
37
"install" : " ^0.10.1" ,
38
38
"lodash.defaultsdeep" : " ^4.6.0" ,
39
39
"loopback-ds-timestamp-mixin" : " ^3.4.1" ,
40
+ "uid" : " 0.0.2" ,
40
41
"vue-awesome" : " ^2.3.4" ,
41
42
"vue-router" : " ^3.0.1" ,
42
43
"vue-template-compiler" : " ^2.5.3" ,
You can’t perform that action at this time.
0 commit comments