File tree Expand file tree Collapse file tree 6 files changed +55
-1
lines changed Expand file tree Collapse file tree 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
20203 . ` server ` : Loopback server files
21214 . ` test ` : Unit test
2222
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+
2330## Linting
2431
2532```
Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ export default {
1313 hello: ' Hello World!' ,
1414 }),
1515 {{/ unless}}
16+ created () {
17+ // Boot Application
18+ this .$store .dispatch (' async/syncLoopback' );
19+ }
1620}
1721 </script >
1822
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ function addTokenFromLocalStorage(http) {
2828
2929const http = axios . create ( {
3030 baseURL : `http://${ host } :${ port } ${ restApiRoot } ` ,
31- } ) ; fi
31+ } ) ;
3232
3333// Current setLoading function
3434let setLoading = ( ) => {
Original file line number Diff line number Diff line change 11import Vue from 'vue' ;
22import Vuex from 'vuex' ;
33
4+ import async from './modules/async' ;
45import auth from './modules/auth' ;
56
67Vue . use ( Vuex ) ;
@@ -16,6 +17,7 @@ export default new Vuex.Store({
1617 } ] ,
1718 } ,
1819 modules : {
20+ async, // async namespaced
1921 auth, // auth namespaced
2022 } ,
2123} ) ;
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 3737 "install" : " ^0.10.1" ,
3838 "lodash.defaultsdeep" : " ^4.6.0" ,
3939 "loopback-ds-timestamp-mixin" : " ^3.4.1" ,
40+ "uid" : " 0.0.2" ,
4041 "vue-awesome" : " ^2.3.4" ,
4142 "vue-router" : " ^3.0.1" ,
4243 "vue-template-compiler" : " ^2.5.3" ,
You can’t perform that action at this time.
0 commit comments