@thzero/library_client_vue3_store_pinia 0.17.4 → 0.17.5
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 +17 -17
- package/license.md +8 -8
- package/openSource.js +52 -52
- package/package.json +30 -30
- package/service/store/index.js +51 -51
- package/store/admin/news/index.js +76 -76
- package/store/admin/users/index.js +63 -63
- package/store/index.js +314 -314
- package/store/news/index.js +43 -43
- package/store/user/index.js +135 -135
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-

|
|
2
|
-

|
|
3
|
-
[](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
|
-
[](https://npmjs.org/package/@thzero/library_client_vue3_store_pinia)
|
|
1
|
+

|
|
2
|
+

|
|
3
|
+
[](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
|
+
[](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-2023 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-2023 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.17.
|
|
4
|
-
"version_major": 0,
|
|
5
|
-
"version_minor": 17,
|
|
6
|
-
"version_patch":
|
|
7
|
-
"version_date": "03/
|
|
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.17",
|
|
24
|
-
"@thzero/library_client_vue3": "^0.17",
|
|
25
|
-
"@thzero/library_common": "^0.17",
|
|
26
|
-
"pinia": "^2.0.
|
|
27
|
-
"pinia-plugin-persistedstate": "^3.0
|
|
28
|
-
"pinia-plugin-persistedstate-2": "^2.0.
|
|
29
|
-
"vue": "^3.2.47"
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@thzero/library_client_vue3_store_pinia",
|
|
3
|
+
"version": "0.17.5",
|
|
4
|
+
"version_major": 0,
|
|
5
|
+
"version_minor": 17,
|
|
6
|
+
"version_patch": 5,
|
|
7
|
+
"version_date": "03/12/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.17",
|
|
24
|
+
"@thzero/library_client_vue3": "^0.17",
|
|
25
|
+
"@thzero/library_common": "^0.17",
|
|
26
|
+
"pinia": "^2.0.33",
|
|
27
|
+
"pinia-plugin-persistedstate": "^3.1.0",
|
|
28
|
+
"pinia-plugin-persistedstate-2": "^2.0.14",
|
|
29
|
+
"vue": "^3.2.47"
|
|
30
|
+
}
|
|
31
31
|
}
|
package/service/store/index.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import LibraryClientUtility from '@thzero/library_client/utility/index';
|
|
2
|
-
|
|
3
|
-
import Service from '@thzero/library_client/service/index';
|
|
4
|
-
|
|
5
|
-
class PiniaStoreService extends Service {
|
|
6
|
-
get dispatcher() {
|
|
7
|
-
return LibraryClientUtility.$store.dispatcher;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
get getters() {
|
|
11
|
-
return LibraryClientUtility.$store.getters;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
get news() {
|
|
15
|
-
return LibraryClientUtility.$store.news;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
get state() {
|
|
19
|
-
return LibraryClientUtility.$store;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
get user() {
|
|
23
|
-
return LibraryClientUtility.$store.user.user;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get userClaims() {
|
|
27
|
-
return LibraryClientUtility.$store.user.claims;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get userToken() {
|
|
31
|
-
return LibraryClientUtility.$store.user.token;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get userAuthCompleted() {
|
|
35
|
-
return LibraryClientUtility.$store.user.authCompleted;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get userAuthIsLoggedIn() {
|
|
39
|
-
return LibraryClientUtility.$store.user.isLoggedIn;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
get userTheme() {
|
|
43
|
-
return LibraryClientUtility.$store.user.theme;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
get userTokenResult() {
|
|
47
|
-
return LibraryClientUtility.$store.user.tokenResult;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default PiniaStoreService;
|
|
1
|
+
import LibraryClientUtility from '@thzero/library_client/utility/index';
|
|
2
|
+
|
|
3
|
+
import Service from '@thzero/library_client/service/index';
|
|
4
|
+
|
|
5
|
+
class PiniaStoreService extends Service {
|
|
6
|
+
get dispatcher() {
|
|
7
|
+
return LibraryClientUtility.$store.dispatcher;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
get getters() {
|
|
11
|
+
return LibraryClientUtility.$store.getters;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get news() {
|
|
15
|
+
return LibraryClientUtility.$store.news;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get state() {
|
|
19
|
+
return LibraryClientUtility.$store;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get user() {
|
|
23
|
+
return LibraryClientUtility.$store.user.user;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get userClaims() {
|
|
27
|
+
return LibraryClientUtility.$store.user.claims;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
get userToken() {
|
|
31
|
+
return LibraryClientUtility.$store.user.token;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get userAuthCompleted() {
|
|
35
|
+
return LibraryClientUtility.$store.user.authCompleted;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get userAuthIsLoggedIn() {
|
|
39
|
+
return LibraryClientUtility.$store.user.isLoggedIn;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
get userTheme() {
|
|
43
|
+
return LibraryClientUtility.$store.user.theme;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get userTokenResult() {
|
|
47
|
+
return LibraryClientUtility.$store.user.tokenResult;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default PiniaStoreService;
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
import LibraryClientConstants from '@thzero/library_client/constants';
|
|
2
|
-
|
|
3
|
-
import LibraryClientUtility from '@thzero/library_client/utility/index';
|
|
4
|
-
import LibraryCommonUtility 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 = LibraryClientUtility.$injector.getService(LibraryClientConstants.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 = LibraryCommonUtility.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 = LibraryClientUtility.$injector.getService(LibraryClientConstants.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 = LibraryCommonUtility.deleteArrayById(this.news, id);
|
|
32
|
-
LibraryClientUtility.$store.dispatcher.news.delete(correlationId, id);
|
|
33
|
-
}
|
|
34
|
-
return response;
|
|
35
|
-
},
|
|
36
|
-
async searchAdminNews(correlationId, params) {
|
|
37
|
-
const service = LibraryClientUtility.$injector.getService(LibraryClientConstants.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 = LibraryClientUtility.$injector.getService(LibraryClientConstants.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 = LibraryCommonUtility.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 LibraryClientUtility.$store.createAdminNews(correlationId, item);
|
|
63
|
-
},
|
|
64
|
-
async deleteAdminNews(correlationId, id) {
|
|
65
|
-
return await LibraryClientUtility.$store.deleteAdminNews(correlationId, id);
|
|
66
|
-
},
|
|
67
|
-
async searchNews(correlationId, params) {
|
|
68
|
-
await LibraryClientUtility.$store.searchAdminNews(correlationId, params);
|
|
69
|
-
},
|
|
70
|
-
async updateAdminNews(correlationId, item) {
|
|
71
|
-
return await LibraryClientUtility.$store.updateAdminNews(correlationId, item);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export default store;
|
|
1
|
+
import LibraryClientConstants from '@thzero/library_client/constants';
|
|
2
|
+
|
|
3
|
+
import LibraryClientUtility from '@thzero/library_client/utility/index';
|
|
4
|
+
import LibraryCommonUtility 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 = LibraryClientUtility.$injector.getService(LibraryClientConstants.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 = LibraryCommonUtility.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 = LibraryClientUtility.$injector.getService(LibraryClientConstants.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 = LibraryCommonUtility.deleteArrayById(this.news, id);
|
|
32
|
+
LibraryClientUtility.$store.dispatcher.news.delete(correlationId, id);
|
|
33
|
+
}
|
|
34
|
+
return response;
|
|
35
|
+
},
|
|
36
|
+
async searchAdminNews(correlationId, params) {
|
|
37
|
+
const service = LibraryClientUtility.$injector.getService(LibraryClientConstants.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 = LibraryClientUtility.$injector.getService(LibraryClientConstants.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 = LibraryCommonUtility.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 LibraryClientUtility.$store.createAdminNews(correlationId, item);
|
|
63
|
+
},
|
|
64
|
+
async deleteAdminNews(correlationId, id) {
|
|
65
|
+
return await LibraryClientUtility.$store.deleteAdminNews(correlationId, id);
|
|
66
|
+
},
|
|
67
|
+
async searchNews(correlationId, params) {
|
|
68
|
+
await LibraryClientUtility.$store.searchAdminNews(correlationId, params);
|
|
69
|
+
},
|
|
70
|
+
async updateAdminNews(correlationId, item) {
|
|
71
|
+
return await LibraryClientUtility.$store.updateAdminNews(correlationId, item);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default store;
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import LibraryClientConstants from '@thzero/library_client/constants';
|
|
2
|
-
|
|
3
|
-
import LibraryClientUtility from '@thzero/library_client/utility/index';
|
|
4
|
-
import LibraryCommonUtility 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 = LibraryClientUtility.$injector.getService(LibraryClientConstants.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 = LibraryCommonUtility.deleteArrayById(this.users, id);
|
|
20
|
-
LibraryClientUtility.$store.dispatcher.users.delete(correlationId, id);
|
|
21
|
-
}
|
|
22
|
-
return response;
|
|
23
|
-
},
|
|
24
|
-
async searchAdminUsers(correlationId, params) {
|
|
25
|
-
const service = LibraryClientUtility.$injector.getService(LibraryClientConstants.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 = LibraryClientUtility.$injector.getService(LibraryClientConstants.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 = LibraryCommonUtility.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 LibraryClientUtility.$store.deleteAdminUser(correlationId, id);
|
|
53
|
-
},
|
|
54
|
-
async searchAdminUsers(correlationId, params) {
|
|
55
|
-
await LibraryClientUtility.$store.searchAdminUsers(correlationId, params);
|
|
56
|
-
},
|
|
57
|
-
async updateAdminUser(correlationId, item) {
|
|
58
|
-
return await LibraryClientUtility.$store.updateAdminUser(correlationId, item);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export default store;
|
|
1
|
+
import LibraryClientConstants from '@thzero/library_client/constants';
|
|
2
|
+
|
|
3
|
+
import LibraryClientUtility from '@thzero/library_client/utility/index';
|
|
4
|
+
import LibraryCommonUtility 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 = LibraryClientUtility.$injector.getService(LibraryClientConstants.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 = LibraryCommonUtility.deleteArrayById(this.users, id);
|
|
20
|
+
LibraryClientUtility.$store.dispatcher.users.delete(correlationId, id);
|
|
21
|
+
}
|
|
22
|
+
return response;
|
|
23
|
+
},
|
|
24
|
+
async searchAdminUsers(correlationId, params) {
|
|
25
|
+
const service = LibraryClientUtility.$injector.getService(LibraryClientConstants.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 = LibraryClientUtility.$injector.getService(LibraryClientConstants.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 = LibraryCommonUtility.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 LibraryClientUtility.$store.deleteAdminUser(correlationId, id);
|
|
53
|
+
},
|
|
54
|
+
async searchAdminUsers(correlationId, params) {
|
|
55
|
+
await LibraryClientUtility.$store.searchAdminUsers(correlationId, params);
|
|
56
|
+
},
|
|
57
|
+
async updateAdminUser(correlationId, item) {
|
|
58
|
+
return await LibraryClientUtility.$store.updateAdminUser(correlationId, item);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default store;
|