@thzero/library_client_vue3_store_pinia 0.16.10
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 +9 -0
- package/license.md +9 -0
- package/package.json +32 -0
- package/service/store/pinia.js +19 -0
- package/store/admin/news/pinia.js +76 -0
- package/store/admin/users/pinia.js +63 -0
- package/store/news/pinia.js +38 -0
- package/store/pinia.js +73 -0
- package/store/user/pinia.js +114 -0
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+

|
|
2
|
+

|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
|
|
5
|
+
# library_client_vue3_store_pinia
|
|
6
|
+
|
|
7
|
+
An opinionated library for vue3 with pinia store for the library_client_vue3.
|
|
8
|
+
|
|
9
|
+
[](https://npmjs.org/package/@thzero/library_client_vue3_store_pinia)
|
package/license.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 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
|
+
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/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@thzero/library_client_vue3_store_pinia",
|
|
3
|
+
"version": "0.16.10",
|
|
4
|
+
"version_major": 0,
|
|
5
|
+
"version_minor": 16,
|
|
6
|
+
"version_patch": 10,
|
|
7
|
+
"version_date": "11/23/2022",
|
|
8
|
+
"description": "An opinionated library of common functionality to bootstrap a VueJs based SPA application.",
|
|
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
|
+
"cli-update": "./node_modules/.bin/library-cli --updateversion --pi",
|
|
21
|
+
"cli-update-w": ".\\node_modules\\.bin\\library-cli --updateversion --pi",
|
|
22
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@thzero/library_client": "^0.16",
|
|
26
|
+
"@thzero/library_client_vue3": "^0.16",
|
|
27
|
+
"@thzero/library_common": "^0.16",
|
|
28
|
+
"pinia": "^2.0.24",
|
|
29
|
+
"pinia-plugin-persist": "^1.0.0",
|
|
30
|
+
"vue": "^3.2.13"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get state() {
|
|
15
|
+
return GlobalUtility.$store;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default PiniaStoreService;
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import LibraryConstants from '@thzero/library_client/constants';
|
|
2
|
+
|
|
3
|
+
import GlobalUtility from '@thzero/library_client/utility/global';
|
|
4
|
+
|
|
5
|
+
const store = {
|
|
6
|
+
state: () => ({
|
|
7
|
+
latest: null
|
|
8
|
+
}),
|
|
9
|
+
actions: {
|
|
10
|
+
async getLatestNews(correlationId) {
|
|
11
|
+
const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_NEWS);
|
|
12
|
+
const response = await service.latest(correlationId);
|
|
13
|
+
this.$logger.debug('store.news', 'getLatestNews', 'response', response);
|
|
14
|
+
// commit('setLatestNews', { correlationId: correlationId, latest: response.success && response.results ? response.results.data : null });
|
|
15
|
+
const latest = response.success && response.results ? response.results.data : null;
|
|
16
|
+
this.$logger.debug('store.news', 'setLatest', 'item.a', latest, correlationId);
|
|
17
|
+
this.$logger.debug('store.news', 'setLatest', 'item.b', this.latest, correlationId);
|
|
18
|
+
this.latest = latest;
|
|
19
|
+
this.$logger.debug('store.news', 'setLatest', 'item.c', this.latest, correlationId);
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
mutations: {
|
|
23
|
+
// setLatestNews(state, params) {
|
|
24
|
+
// this.$logger.debug('store.news', 'setLatest', 'item.a', params.latest, params.correlationId);
|
|
25
|
+
// this.$logger.debug('store.news', 'setLatest', 'item.b', state.latest, params.correlationId);
|
|
26
|
+
// state.latest = params.latest;
|
|
27
|
+
// this.$logger.debug('store.news', 'setLatest', 'item.c', state.latest, params.correlationId);
|
|
28
|
+
// }
|
|
29
|
+
},
|
|
30
|
+
dispatcher: {
|
|
31
|
+
async getLatest(correlationId) {
|
|
32
|
+
// await GlobalUtility.$store.dispatch('getLatestNews', correlationId);
|
|
33
|
+
await GlobalUtility.$store.news.getLatestNews(correlationId);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default store;
|
package/store/pinia.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createPinia, defineStore } from 'pinia';
|
|
2
|
+
import piniaPersist from 'pinia-plugin-persist';
|
|
3
|
+
|
|
4
|
+
import LibraryConstants from '@thzero/library_client/constants';
|
|
5
|
+
|
|
6
|
+
import GlobalUtility from '@thzero/library_client/utility/global';
|
|
7
|
+
|
|
8
|
+
import NotImplementedError from '@thzero/library_common/errors/notImplemented';
|
|
9
|
+
|
|
10
|
+
// import adminNews from './admin/news';
|
|
11
|
+
// import adminUsers from './admin/users';
|
|
12
|
+
|
|
13
|
+
import news from './news/pinia';
|
|
14
|
+
import user from './user/pinia';
|
|
15
|
+
|
|
16
|
+
class BaseStore {
|
|
17
|
+
async initialize() {
|
|
18
|
+
this.pinia = createPinia();
|
|
19
|
+
|
|
20
|
+
this.actionDispatcher = {};
|
|
21
|
+
|
|
22
|
+
const storeConfig = this._init();
|
|
23
|
+
|
|
24
|
+
const pluginPersist = this._initPluginPersist();
|
|
25
|
+
if (pluginPersist) {
|
|
26
|
+
storeConfig.persist = pluginPersist;
|
|
27
|
+
this.pinia.use(piniaPersist);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
this.actionDispatcher = storeConfig.dispatcher;
|
|
31
|
+
|
|
32
|
+
const logger = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_LOGGER);
|
|
33
|
+
|
|
34
|
+
const storeFunc = defineStore('main', storeConfig);
|
|
35
|
+
GlobalUtility.$store = storeFunc(this.pinia);
|
|
36
|
+
GlobalUtility.$store.$logger = logger;
|
|
37
|
+
|
|
38
|
+
// this._addModule('adminNews', adminNews);
|
|
39
|
+
// this._addModule('adminUsers', adminUsers);
|
|
40
|
+
this._addModule('news', news, logger);
|
|
41
|
+
this._addModule('user', user, logger);
|
|
42
|
+
this._initModules();
|
|
43
|
+
GlobalUtility.$store.dispatcher = this.actionDispatcher;
|
|
44
|
+
|
|
45
|
+
console.debug(GlobalUtility);
|
|
46
|
+
console.debug(GlobalUtility.$store);
|
|
47
|
+
console.debug(GlobalUtility.$store.dispatcher);
|
|
48
|
+
|
|
49
|
+
return this.pinia;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
_addModule(name, storeConfig, logger) {
|
|
53
|
+
this.actionDispatcher[name] = storeConfig.dispatcher;
|
|
54
|
+
delete storeConfig.dispatcher;
|
|
55
|
+
const storeFunc = defineStore(name, storeConfig);
|
|
56
|
+
GlobalUtility.$store[name] = storeFunc(this.pinia);
|
|
57
|
+
GlobalUtility.$store[name].$logger = logger;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
_init() {
|
|
61
|
+
throw new NotImplementedError();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
_initModules() {
|
|
65
|
+
throw new NotImplementedError();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
_initPluginPersist() {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default BaseStore;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import LibraryConstants from '@thzero/library_client/constants';
|
|
2
|
+
|
|
3
|
+
import GlobalUtility from '@thzero/library_client/utility/global';
|
|
4
|
+
import VueUtility from '@thzero/library_client_vue3/utility';
|
|
5
|
+
|
|
6
|
+
import Response from '@thzero/library_common/response';
|
|
7
|
+
|
|
8
|
+
const store = {
|
|
9
|
+
state: () => ({
|
|
10
|
+
authCompleted: false,
|
|
11
|
+
claims: null,
|
|
12
|
+
isLoggedIn: false,
|
|
13
|
+
token: null,
|
|
14
|
+
tokenResult: null,
|
|
15
|
+
user: null
|
|
16
|
+
}),
|
|
17
|
+
actions: {
|
|
18
|
+
async refreshUserSettings(correlationId) {
|
|
19
|
+
const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_USER);
|
|
20
|
+
const response = await service.refreshSettings(correlationId, this.user);
|
|
21
|
+
this.$logger.debug('store.user', 'refreshUserSettings', 'response', response);
|
|
22
|
+
if (Response.hasSucceeded(response) && response.results)
|
|
23
|
+
this.setUser(response.results);
|
|
24
|
+
return response;
|
|
25
|
+
},
|
|
26
|
+
async resetUser(correlationId) {
|
|
27
|
+
this.$patch({
|
|
28
|
+
claims: null,
|
|
29
|
+
isLoggedIn: false,
|
|
30
|
+
token: null,
|
|
31
|
+
tokenResult: null,
|
|
32
|
+
user: null
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
async setUserAuthCompleted(correlationId, authCompleted) {
|
|
36
|
+
this.authCompleted = authCompleted;
|
|
37
|
+
},
|
|
38
|
+
async setUserClaims(correlationId, claims) {
|
|
39
|
+
this.claims = claims;
|
|
40
|
+
},
|
|
41
|
+
async setUserLoggedIn(correlationId, isLoggedIn) {
|
|
42
|
+
this.isLoggedIn = isLoggedIn;
|
|
43
|
+
},
|
|
44
|
+
async setUserSettings(correlationId, settings) {
|
|
45
|
+
const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_USER);
|
|
46
|
+
settings = VueUtility.settings().mergeUser(params.correlationId, settings);
|
|
47
|
+
const response = await service.updateSettings(params.correlationId, this.user, settings);
|
|
48
|
+
this.$logger.debug('store.user', 'setUserSettings', 'response', response);
|
|
49
|
+
if (Response.hasSucceeded(response) && response.results)
|
|
50
|
+
this.setUser(correlationId, response.results);
|
|
51
|
+
return response;
|
|
52
|
+
},
|
|
53
|
+
async setUserSettings2(correlationId, settings) {
|
|
54
|
+
const service = GlobalUtility.$injector.getService(LibraryConstants.InjectorKeys.SERVICE_USER);
|
|
55
|
+
settings = VueUtility.settings().mergeUser(params.correlationId, settings);
|
|
56
|
+
const response = await service.updateSettings(params.correlationId, this.user, settings);
|
|
57
|
+
this.$logger.debug('store.user', 'setUserSettings', 'response', response);
|
|
58
|
+
if (Response.hasSucceeded(response) && response.results) {
|
|
59
|
+
// commit('setUserSettings', { correlationId: params.correlationId, user: response.results });
|
|
60
|
+
const user = response.results;
|
|
61
|
+
user.settings = VueUtility.settings().mergeUser(correlationId, user.settings);
|
|
62
|
+
this.user = user;
|
|
63
|
+
}
|
|
64
|
+
return response;
|
|
65
|
+
},
|
|
66
|
+
async setUserTokenResult(correlationId, tokenResult) {
|
|
67
|
+
this.$patch({
|
|
68
|
+
tokenResult: null,
|
|
69
|
+
token: tokenResult ? tokenResult.token : null
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
async setUser(correlationId, user) {
|
|
73
|
+
if (user)
|
|
74
|
+
user.settings = VueUtility.settings().mergeUser(correlationId, user.settings);
|
|
75
|
+
this.user = user;
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
dispatcher: {
|
|
79
|
+
async refreshUserSettings(correlationId) {
|
|
80
|
+
// await GlobalUtility.$store.dispatch('refreshUserSettings', correlationId);
|
|
81
|
+
await GlobalUtility.$store.user.refreshUserSettings(correlationId);
|
|
82
|
+
},
|
|
83
|
+
async resetUser(correlationId) {
|
|
84
|
+
// await GlobalUtility.$store.dispatch('resetUser', correlationId);
|
|
85
|
+
await GlobalUtility.$store.user.resetUser(correlationId);
|
|
86
|
+
},
|
|
87
|
+
async setAuthCompleted(correlationId, authCompleted) {
|
|
88
|
+
// await GlobalUtility.$store.dispatch('setUserAuthCompleted', { correlationId: correlationId, authCompleted: authCompleted });
|
|
89
|
+
await GlobalUtility.$store.user.setUserAuthCompleted(correlationId, authCompleted);
|
|
90
|
+
},
|
|
91
|
+
async setClaims(correlationId, claims) {
|
|
92
|
+
// await GlobalUtility.$store.dispatch('setUserClaims', { correlationId: correlationId, authCompleted: claims });
|
|
93
|
+
await GlobalUtility.$store.user.setUserClaims(correlationId, claims);
|
|
94
|
+
},
|
|
95
|
+
async setLoggedIn(correlationId, isLoggedIn) {
|
|
96
|
+
// await GlobalUtility.$store.dispatch('setUserLoggedIn', { correlationId: correlationId, isLoggedIn: isLoggedIn });
|
|
97
|
+
await GlobalUtility.$store.user.setUserLoggedIn(correlationId, isLoggedIn);
|
|
98
|
+
},
|
|
99
|
+
async setUserSettings(correlationId, settings) {
|
|
100
|
+
// return await GlobalUtility.$store.dispatch('setUserSettings', { correlationId: correlationId, settings: settings });
|
|
101
|
+
await GlobalUtility.$store.user.setUserSettings(correlationId, settings);
|
|
102
|
+
},
|
|
103
|
+
async setTokenResult(correlationId, tokenResult) {
|
|
104
|
+
// await GlobalUtility.$store.dispatch('setUserTokenResult', { correlationId: correlationId, tokenResult: tokenResult });
|
|
105
|
+
await GlobalUtility.$store.user.setUserTokenResult(correlationId, tokenResult);
|
|
106
|
+
},
|
|
107
|
+
async setUser(correlationId, user) {
|
|
108
|
+
// await GlobalUtility.$store.dispatch('setUser', { correlationId: correlationId, user: user });
|
|
109
|
+
await GlobalUtility.$store.user.setUser(correlationId, user);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export default store;
|