@thzero/library_client_vue3_store_pinia 0.16.23 → 0.16.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,17 +1,17 @@
1
- ![GitHub package.json version](https://img.shields.io/github/package-json/v/thzero/library_client_vue3_store_pinia)
2
- ![David](https://img.shields.io/david/thzero/library_client_vue3_store_pinia)
3
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
-
5
- # library_client_vue3_store_pinia
6
-
7
- An opinionated library for vue3 with [Pinia](https://github.com/vuejs/pinia) store for the library_client_vue3 using the [pinia-plugin-persistedstate](https://prazdevs.github.io/pinia-plugin-persistedstate) or [pinia-plugin-persistedstate-2](https://github.com/iendeavor/pinia-plugin-persistedstate-2) library.
8
-
9
- ## Requirements
10
-
11
- ### NodeJs
12
-
13
- [NodeJs](https://nodejs.org) version 18+
14
-
15
- ## Installation
16
-
17
- [![NPM](https://nodei.co/npm/@thzero/library_common.png?compact=true)](https://npmjs.org/package/@thzero/library_client_vue3_store_pinia)
1
+ ![GitHub package.json version](https://img.shields.io/github/package-json/v/thzero/library_client_vue3_store_pinia)
2
+ ![David](https://img.shields.io/david/thzero/library_client_vue3_store_pinia)
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+
5
+ # library_client_vue3_store_pinia
6
+
7
+ An opinionated library for vue3 with [Pinia](https://github.com/vuejs/pinia) store for the library_client_vue3 using the [pinia-plugin-persistedstate](https://prazdevs.github.io/pinia-plugin-persistedstate) or [pinia-plugin-persistedstate-2](https://github.com/iendeavor/pinia-plugin-persistedstate-2) library.
8
+
9
+ ## Requirements
10
+
11
+ ### NodeJs
12
+
13
+ [NodeJs](https://nodejs.org) version 18+
14
+
15
+ ## Installation
16
+
17
+ [![NPM](https://nodei.co/npm/@thzero/library_common.png?compact=true)](https://npmjs.org/package/@thzero/library_client_vue3_store_pinia)
package/license.md CHANGED
@@ -1,9 +1,9 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 thZero.com
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
1
+ MIT License
2
+
3
+ Copyright (c) 2022 thZero.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
9
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/openSource.js CHANGED
@@ -1,53 +1,53 @@
1
- export default () => {
2
- return [
3
- {
4
- category: 'client',
5
- name: '@thzero/library_client',
6
- url: 'https://github.com/thzero/library_client',
7
- licenseName: 'MIT',
8
- licenseUrl: 'https://github.com/thzero/library_client/blob/master/license.md'
9
- },
10
- {
11
- category: 'client',
12
- name: '@thzero/library_client_vue3',
13
- url: 'https://github.com/thzero/library_client_vue3',
14
- licenseName: 'MIT',
15
- licenseUrl: 'https://github.com/thzero/library_client_vue3/blob/master/license.md'
16
- },
17
- {
18
- category: 'client',
19
- name: '@thzero/library_client_vue3_store_pinia',
20
- url: 'https://github.com/thzero/library_client_vue3_store_pinia',
21
- licenseName: 'MIT',
22
- licenseUrl: 'https://github.com/thzero/library_client_vue3_store_pinia/blob/master/license.md'
23
- },
24
- {
25
- category: 'client',
26
- name: '@thzero/library_common',
27
- url: 'https://github.com/thzero/library_common',
28
- licenseName: 'MIT',
29
- licenseUrl: 'https://github.com/thzero/library_common/blob/master/license.md'
30
- },
31
- {
32
- category: 'client',
33
- name: 'pinia',
34
- url: 'https://github.com/vuejs/pinia',
35
- licenseName: 'MIT',
36
- licenseUrl: 'https://github.com/vuejs/pinia/blob/v2/LICENSE'
37
- },
38
- {
39
- category: 'client',
40
- name: 'pinia-plugin-persistedstate-2',
41
- url: 'https://github.com/iendeavor/pinia-plugin-persistedstate-2',
42
- licenseName: 'MIT',
43
- licenseUrl: 'https://github.com/iendeavor/pinia-plugin-persistedstate-2/blob/main/LICENSE'
44
- },
45
- {
46
- category: 'client',
47
- name: 'vue',
48
- url: 'https://github.com/vuejs/vue',
49
- licenseName: 'MIT',
50
- licenseUrl: 'https://github.com/vuejs/vue/blob/dev/LICENSE'
51
- }
52
- ];
1
+ export default () => {
2
+ return [
3
+ {
4
+ category: 'client',
5
+ name: '@thzero/library_client',
6
+ url: 'https://github.com/thzero/library_client',
7
+ licenseName: 'MIT',
8
+ licenseUrl: 'https://github.com/thzero/library_client/blob/master/license.md'
9
+ },
10
+ {
11
+ category: 'client',
12
+ name: '@thzero/library_client_vue3',
13
+ url: 'https://github.com/thzero/library_client_vue3',
14
+ licenseName: 'MIT',
15
+ licenseUrl: 'https://github.com/thzero/library_client_vue3/blob/master/license.md'
16
+ },
17
+ {
18
+ category: 'client',
19
+ name: '@thzero/library_client_vue3_store_pinia',
20
+ url: 'https://github.com/thzero/library_client_vue3_store_pinia',
21
+ licenseName: 'MIT',
22
+ licenseUrl: 'https://github.com/thzero/library_client_vue3_store_pinia/blob/master/license.md'
23
+ },
24
+ {
25
+ category: 'client',
26
+ name: '@thzero/library_common',
27
+ url: 'https://github.com/thzero/library_common',
28
+ licenseName: 'MIT',
29
+ licenseUrl: 'https://github.com/thzero/library_common/blob/master/license.md'
30
+ },
31
+ {
32
+ category: 'client',
33
+ name: 'pinia',
34
+ url: 'https://github.com/vuejs/pinia',
35
+ licenseName: 'MIT',
36
+ licenseUrl: 'https://github.com/vuejs/pinia/blob/v2/LICENSE'
37
+ },
38
+ {
39
+ category: 'client',
40
+ name: 'pinia-plugin-persistedstate-2',
41
+ url: 'https://github.com/iendeavor/pinia-plugin-persistedstate-2',
42
+ licenseName: 'MIT',
43
+ licenseUrl: 'https://github.com/iendeavor/pinia-plugin-persistedstate-2/blob/main/LICENSE'
44
+ },
45
+ {
46
+ category: 'client',
47
+ name: 'vue',
48
+ url: 'https://github.com/vuejs/vue',
49
+ licenseName: 'MIT',
50
+ licenseUrl: 'https://github.com/vuejs/vue/blob/dev/LICENSE'
51
+ }
52
+ ];
53
53
  }
package/package.json CHANGED
@@ -1,31 +1,31 @@
1
- {
2
- "name": "@thzero/library_client_vue3_store_pinia",
3
- "version": "0.16.23",
4
- "version_major": 0,
5
- "version_minor": 16,
6
- "version_patch": 23,
7
- "version_date": "12/20/2022",
8
- "description": "An opinionated library for vue3 with pinia store for the library_client_vue3 using the https://prazdevs.github.io/pinia-plugin-persistedstate library.",
9
- "author": "thZero",
10
- "license": "MIT",
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/thzero/library_client_vue3_store_pinia.git"
14
- },
15
- "bugs": {
16
- "url": "https://github.com/thzero/library_client_vue3_store_pinia/issues"
17
- },
18
- "homepage": "https://github.com/thzero/library_client_vue3_store_pinia#readme",
19
- "scripts": {
20
- "test": "echo \"Error: no test specified\" && exit 1"
21
- },
22
- "dependencies": {
23
- "@thzero/library_client": "^0.16",
24
- "@thzero/library_client_vue3": "^0.16",
25
- "@thzero/library_common": "^0.16",
26
- "pinia": "^2.0.28",
27
- "pinia-plugin-persistedstate": "^3.0.1",
28
- "pinia-plugin-persistedstate-2": "^2.0.6",
29
- "vue": "^3.2.45"
30
- }
1
+ {
2
+ "name": "@thzero/library_client_vue3_store_pinia",
3
+ "version": "0.16.26",
4
+ "version_major": 0,
5
+ "version_minor": 16,
6
+ "version_patch": 26,
7
+ "version_date": "01/08/2023",
8
+ "description": "An opinionated library for vue3 with pinia store for the library_client_vue3 using the https://prazdevs.github.io/pinia-plugin-persistedstate library.",
9
+ "author": "thZero",
10
+ "license": "MIT",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/thzero/library_client_vue3_store_pinia.git"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/thzero/library_client_vue3_store_pinia/issues"
17
+ },
18
+ "homepage": "https://github.com/thzero/library_client_vue3_store_pinia#readme",
19
+ "scripts": {
20
+ "test": "echo \"Error: no test specified\" && exit 1"
21
+ },
22
+ "dependencies": {
23
+ "@thzero/library_client": "^0.16",
24
+ "@thzero/library_client_vue3": "^0.16",
25
+ "@thzero/library_common": "^0.16",
26
+ "pinia": "^2.0.28",
27
+ "pinia-plugin-persistedstate": "^3.0.2",
28
+ "pinia-plugin-persistedstate-2": "^2.0.8",
29
+ "vue": "^3.2.45"
30
+ }
31
31
  }
@@ -1,47 +1,47 @@
1
- import GlobalUtility from '@thzero/library_client/utility/global';
2
-
3
- import Service from '@thzero/library_client/service/index';
4
-
5
- class PiniaStoreService extends Service {
6
- get dispatcher() {
7
- return GlobalUtility.$store.dispatcher;
8
- }
9
-
10
- get getters() {
11
- return GlobalUtility.$store.getters;
12
- }
13
-
14
- get state() {
15
- return GlobalUtility.$store;
16
- }
17
-
18
- get user() {
19
- return GlobalUtility.$store.user.user;
20
- }
21
-
22
- get userClaims() {
23
- return GlobalUtility.$store.user.claims;
24
- }
25
-
26
- get userToken() {
27
- return GlobalUtility.$store.user.token;
28
- }
29
-
30
- get userAuthCompleted() {
31
- return GlobalUtility.$store.user.authCompleted;
32
- }
33
-
34
- get userAuthIsLoggedIn() {
35
- return GlobalUtility.$store.user.isLoggedIn;
36
- }
37
-
38
- get userTheme() {
39
- return GlobalUtility.$store.user.theme;
40
- }
41
-
42
- get userTokenResult() {
43
- return GlobalUtility.$store.user.tokenResult;
44
- }
45
- }
46
-
47
- export default PiniaStoreService;
1
+ import GlobalUtility from '@thzero/library_client/utility/global';
2
+
3
+ import Service from '@thzero/library_client/service/index';
4
+
5
+ class PiniaStoreService extends Service {
6
+ get dispatcher() {
7
+ return GlobalUtility.$store.dispatcher;
8
+ }
9
+
10
+ get getters() {
11
+ return GlobalUtility.$store.getters;
12
+ }
13
+
14
+ get state() {
15
+ return GlobalUtility.$store;
16
+ }
17
+
18
+ get user() {
19
+ return GlobalUtility.$store.user.user;
20
+ }
21
+
22
+ get userClaims() {
23
+ return GlobalUtility.$store.user.claims;
24
+ }
25
+
26
+ get userToken() {
27
+ return GlobalUtility.$store.user.token;
28
+ }
29
+
30
+ get userAuthCompleted() {
31
+ return GlobalUtility.$store.user.authCompleted;
32
+ }
33
+
34
+ get userAuthIsLoggedIn() {
35
+ return GlobalUtility.$store.user.isLoggedIn;
36
+ }
37
+
38
+ get userTheme() {
39
+ return GlobalUtility.$store.user.theme;
40
+ }
41
+
42
+ get userTokenResult() {
43
+ return GlobalUtility.$store.user.tokenResult;
44
+ }
45
+ }
46
+
47
+ export default PiniaStoreService;
@@ -1,76 +1,76 @@
1
- import LibraryConstants from '@thzero/library_client/constants';
2
-
3
- import GlobalUtility from '@thzero/library_client/utility/global';
4
- import LibraryUtility from '@thzero/library_common/utility';
5
-
6
- import Response from '@thzero/library_common/response';
7
-
8
- const store = {
9
- state: {
10
- news: null
11
- },
12
- actions: {
13
- async createAdminNews(correlationId, item) {
14
- const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_ADMIN_NEWS);
15
- const response = await service.create(correlationId, item);
16
- this.$logger.debug('store.admin.news', 'createAdminNews', 'response', response);
17
- if (Response.hasSucceeded(response)) {
18
- const item = response.success && response.results ? response.results : null;
19
- this.$logger.debug('store.admin.news', 'setAdminNews', 'items.a', item, correlationId);
20
- this.$logger.debug('store.admin.news', 'setAdminNews', 'items.b', this.news, correlationId);
21
- this.news = LibraryUtility.updateArrayById(this.news, item);
22
- this.$logger.debug('store.admin.news', 'setAdminNews', 'items.c', this.news, correlationId);
23
- }
24
- return response;
25
- },
26
- async deleteAdminNews(correlationId, id) {
27
- const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_ADMIN_NEWS);
28
- const response = await service.delete(correlationId, id);
29
- this.$logger.debug('store.admin.news', 'deleteAdminNews', 'response', response);
30
- if (Response.hasSucceeded(response)) {
31
- this.news = LibraryUtility.deleteArrayById(this.news, id);
32
- GlobalUtility.$store.dispatcher.news.delete(correlationId, id);
33
- }
34
- return response;
35
- },
36
- async searchAdminNews(correlationId, params) {
37
- const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_ADMIN_NEWS);
38
- const response = await service.search(correlationId, params);
39
- this.$logger.debug('store.admin.news', 'searchAdminNews', 'response', response);
40
- const list = response.success && response.results ? response.results.data : null;
41
- this.$logger.debug('store.admin.news', 'setAdminNewsListing', 'list.a', list, correlationId);
42
- this.$logger.debug('store.admin.news', 'setAdminNewsListing', 'list.b', this.news, correlationId);
43
- this.news = list;
44
- this.$logger.debug('store.admin.news', 'setAdminNewsListing', 'list.c', this.news, correlationId);
45
- },
46
- async updateAdminNews(correlationId, item) {
47
- const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_ADMIN_NEWS);
48
- const response = await service.update(correlationId, item);
49
- this.$logger.debug('store.admin.news', 'updateAdminNews', 'response', response);
50
- if (Response.hasSucceeded(response)) {
51
- const item = response.success && response.results ? response.results : null;
52
- this.$logger.debug('store.admin.news', 'setAdminNews', 'items.a', item, correlationId);
53
- this.$logger.debug('store.admin.news', 'setAdminNews', 'items.b', this.news, correlationId);
54
- this.news = LibraryUtility.updateArrayById(this.news, item);
55
- this.$logger.debug('store.admin.news', 'setAdminNews', 'items.c', this.news, correlationId);
56
- }
57
- return response;
58
- }
59
- },
60
- dispatcher: {
61
- async createAdminNews(correlationId, item) {
62
- return await GlobalUtility.$store.createAdminNews(correlationId, item);
63
- },
64
- async deleteAdminNews(correlationId, id) {
65
- return await GlobalUtility.$store.deleteAdminNews(correlationId, id);
66
- },
67
- async searchNews(correlationId, params) {
68
- await GlobalUtility.$store.searchAdminNews(correlationId, params);
69
- },
70
- async updateAdminNews(correlationId, item) {
71
- return await GlobalUtility.$store.updateAdminNews(correlationId, item);
72
- }
73
- }
74
- };
75
-
76
- export default store;
1
+ import LibraryConstants from '@thzero/library_client/constants';
2
+
3
+ import GlobalUtility from '@thzero/library_client/utility/global';
4
+ import LibraryUtility from '@thzero/library_common/utility';
5
+
6
+ import Response from '@thzero/library_common/response';
7
+
8
+ const store = {
9
+ state: {
10
+ news: null
11
+ },
12
+ actions: {
13
+ async createAdminNews(correlationId, item) {
14
+ const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_ADMIN_NEWS);
15
+ const response = await service.create(correlationId, item);
16
+ this.$logger.debug('store.admin.news', 'createAdminNews', 'response', response);
17
+ if (Response.hasSucceeded(response)) {
18
+ const item = response.success && response.results ? response.results : null;
19
+ this.$logger.debug('store.admin.news', 'setAdminNews', 'items.a', item, correlationId);
20
+ this.$logger.debug('store.admin.news', 'setAdminNews', 'items.b', this.news, correlationId);
21
+ this.news = LibraryUtility.updateArrayById(this.news, item);
22
+ this.$logger.debug('store.admin.news', 'setAdminNews', 'items.c', this.news, correlationId);
23
+ }
24
+ return response;
25
+ },
26
+ async deleteAdminNews(correlationId, id) {
27
+ const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_ADMIN_NEWS);
28
+ const response = await service.delete(correlationId, id);
29
+ this.$logger.debug('store.admin.news', 'deleteAdminNews', 'response', response);
30
+ if (Response.hasSucceeded(response)) {
31
+ this.news = LibraryUtility.deleteArrayById(this.news, id);
32
+ GlobalUtility.$store.dispatcher.news.delete(correlationId, id);
33
+ }
34
+ return response;
35
+ },
36
+ async searchAdminNews(correlationId, params) {
37
+ const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_ADMIN_NEWS);
38
+ const response = await service.search(correlationId, params);
39
+ this.$logger.debug('store.admin.news', 'searchAdminNews', 'response', response);
40
+ const list = response.success && response.results ? response.results.data : null;
41
+ this.$logger.debug('store.admin.news', 'setAdminNewsListing', 'list.a', list, correlationId);
42
+ this.$logger.debug('store.admin.news', 'setAdminNewsListing', 'list.b', this.news, correlationId);
43
+ this.news = list;
44
+ this.$logger.debug('store.admin.news', 'setAdminNewsListing', 'list.c', this.news, correlationId);
45
+ },
46
+ async updateAdminNews(correlationId, item) {
47
+ const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_ADMIN_NEWS);
48
+ const response = await service.update(correlationId, item);
49
+ this.$logger.debug('store.admin.news', 'updateAdminNews', 'response', response);
50
+ if (Response.hasSucceeded(response)) {
51
+ const item = response.success && response.results ? response.results : null;
52
+ this.$logger.debug('store.admin.news', 'setAdminNews', 'items.a', item, correlationId);
53
+ this.$logger.debug('store.admin.news', 'setAdminNews', 'items.b', this.news, correlationId);
54
+ this.news = LibraryUtility.updateArrayById(this.news, item);
55
+ this.$logger.debug('store.admin.news', 'setAdminNews', 'items.c', this.news, correlationId);
56
+ }
57
+ return response;
58
+ }
59
+ },
60
+ dispatcher: {
61
+ async createAdminNews(correlationId, item) {
62
+ return await GlobalUtility.$store.createAdminNews(correlationId, item);
63
+ },
64
+ async deleteAdminNews(correlationId, id) {
65
+ return await GlobalUtility.$store.deleteAdminNews(correlationId, id);
66
+ },
67
+ async searchNews(correlationId, params) {
68
+ await GlobalUtility.$store.searchAdminNews(correlationId, params);
69
+ },
70
+ async updateAdminNews(correlationId, item) {
71
+ return await GlobalUtility.$store.updateAdminNews(correlationId, item);
72
+ }
73
+ }
74
+ };
75
+
76
+ export default store;
@@ -1,63 +1,63 @@
1
- import LibraryConstants from '@thzero/library_client/constants';
2
-
3
- import GlobalUtility from '@thzero/library_client/utility/global';
4
- import LibraryUtility from '@thzero/library_common/utility';
5
-
6
- import Response from '@thzero/library_common/response';
7
-
8
- const store = {
9
- state: {
10
- users: null
11
- },
12
- actions: {
13
- async deleteAdminUser(correlationId, id) {
14
- const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_ADMIN_USERS);
15
- const response = await service.delete(correlationId, id);
16
- this.$logger.debug('store.admin.users', 'deleteAdminUser', 'response', response);
17
- if (Response.hasSucceeded(response)) {
18
- commit('deleteAdminUser', { correlationId: correlationId, id: id });
19
- this.users = LibraryUtility.deleteArrayById(this.users, id);
20
- GlobalUtility.$store.dispatcher.users.delete(correlationId, id);
21
- }
22
- return response;
23
- },
24
- async searchAdminUsers(correlationId, params) {
25
- const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_ADMIN_USERS);
26
- const response = await service.search(correlationId, params);
27
- this.$logger.debug('store.admin.users', 'searchAdminUsers', 'response', response);
28
- if (Response.hasSucceeded(response)) {
29
- const list = response.success && response.results ? response.results.data : null;
30
- this.$logger.debug('store.admin.users', 'setAdminUsersListing', 'list.a', list, correlationId);
31
- this.$logger.debug('store.admin.users', 'setAdminUsersListing', 'list.b', this.users, correlationId);
32
- this.users = list;
33
- this.$logger.debug('store.admin.users', 'setAdminUsersListing', 'list.c', this.users, correlationId);
34
- }
35
- },
36
- async updateAdminUser(correlationId, item) {
37
- const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_ADMIN_USERS);
38
- const response = await service.update(correlationId, item);
39
- this.$logger.debug('store.admin.users', 'updateAdminUser', 'response', response);
40
- if (Response.hasSucceeded(response)) {
41
- const item = response.results;
42
- this.$logger.debug('store.admin.users', 'setAdminUsers', 'items.a', item, correlationId);
43
- this.$logger.debug('store.admin.users', 'setAdminUsers', 'items.b', this.users, correlationId);
44
- this.users = LibraryUtility.updateArrayById(this.users, item);
45
- this.$logger.debug('store.admin.users', 'setAdminUsers', 'items.c', this.users, correlationId);
46
- }
47
- return response;
48
- }
49
- },
50
- dispatcher: {
51
- async deleteAdminUser(correlationId, id) {
52
- return await GlobalUtility.$store.deleteAdminUser(correlationId, id);
53
- },
54
- async searchAdminUsers(correlationId, params) {
55
- await GlobalUtility.$store.searchAdminUsers(correlationId, params);
56
- },
57
- async updateAdminUser(correlationId, item) {
58
- return await GlobalUtility.$store.updateAdminUser(correlationId, item);
59
- }
60
- }
61
- };
62
-
63
- export default store;
1
+ import LibraryConstants from '@thzero/library_client/constants';
2
+
3
+ import GlobalUtility from '@thzero/library_client/utility/global';
4
+ import LibraryUtility from '@thzero/library_common/utility';
5
+
6
+ import Response from '@thzero/library_common/response';
7
+
8
+ const store = {
9
+ state: {
10
+ users: null
11
+ },
12
+ actions: {
13
+ async deleteAdminUser(correlationId, id) {
14
+ const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_ADMIN_USERS);
15
+ const response = await service.delete(correlationId, id);
16
+ this.$logger.debug('store.admin.users', 'deleteAdminUser', 'response', response);
17
+ if (Response.hasSucceeded(response)) {
18
+ commit('deleteAdminUser', { correlationId: correlationId, id: id });
19
+ this.users = LibraryUtility.deleteArrayById(this.users, id);
20
+ GlobalUtility.$store.dispatcher.users.delete(correlationId, id);
21
+ }
22
+ return response;
23
+ },
24
+ async searchAdminUsers(correlationId, params) {
25
+ const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_ADMIN_USERS);
26
+ const response = await service.search(correlationId, params);
27
+ this.$logger.debug('store.admin.users', 'searchAdminUsers', 'response', response);
28
+ if (Response.hasSucceeded(response)) {
29
+ const list = response.success && response.results ? response.results.data : null;
30
+ this.$logger.debug('store.admin.users', 'setAdminUsersListing', 'list.a', list, correlationId);
31
+ this.$logger.debug('store.admin.users', 'setAdminUsersListing', 'list.b', this.users, correlationId);
32
+ this.users = list;
33
+ this.$logger.debug('store.admin.users', 'setAdminUsersListing', 'list.c', this.users, correlationId);
34
+ }
35
+ },
36
+ async updateAdminUser(correlationId, item) {
37
+ const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_ADMIN_USERS);
38
+ const response = await service.update(correlationId, item);
39
+ this.$logger.debug('store.admin.users', 'updateAdminUser', 'response', response);
40
+ if (Response.hasSucceeded(response)) {
41
+ const item = response.results;
42
+ this.$logger.debug('store.admin.users', 'setAdminUsers', 'items.a', item, correlationId);
43
+ this.$logger.debug('store.admin.users', 'setAdminUsers', 'items.b', this.users, correlationId);
44
+ this.users = LibraryUtility.updateArrayById(this.users, item);
45
+ this.$logger.debug('store.admin.users', 'setAdminUsers', 'items.c', this.users, correlationId);
46
+ }
47
+ return response;
48
+ }
49
+ },
50
+ dispatcher: {
51
+ async deleteAdminUser(correlationId, id) {
52
+ return await GlobalUtility.$store.deleteAdminUser(correlationId, id);
53
+ },
54
+ async searchAdminUsers(correlationId, params) {
55
+ await GlobalUtility.$store.searchAdminUsers(correlationId, params);
56
+ },
57
+ async updateAdminUser(correlationId, item) {
58
+ return await GlobalUtility.$store.updateAdminUser(correlationId, item);
59
+ }
60
+ }
61
+ };
62
+
63
+ export default store;