@thzero/library_client_vue3_store_pinia 0.18.39 → 0.19.1

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,119 @@
1
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
2
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
3
 
5
4
  # library_client_vue3_store_pinia
6
5
 
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.
6
+ The application store for [library_client_vue3](https://github.com/thzero/library_client_vue3), on [Pinia](https://pinia.vuejs.org), with persistence through [pinia-plugin-persistedstate](https://prazdevs.github.io/pinia-plugin-persistedstate).
8
7
 
9
8
  ## Requirements
10
9
 
11
10
  ### NodeJs
12
11
 
13
- [NodeJs](https://nodejs.org) version 18+
12
+ [NodeJs](https://nodejs.org) version 22+.
14
13
 
15
14
  ## Installation
16
15
 
17
- [![NPM](https://nodei.co/npm/@thzero/library_common.png?compact=true)](https://npmjs.org/package/@thzero/library_client_vue3_store_pinia)
16
+ [![NPM](https://nodei.co/npm/@thzero/library_client_vue3_store_pinia.png?compact=true)](https://npmjs.org/package/@thzero/library_client_vue3_store_pinia)
17
+
18
+ ```
19
+ npm install @thzero/library_client_vue3_store_pinia
20
+ ```
21
+
22
+ It installs `pinia` and `pinia-plugin-persistedstate`, and requires `@thzero/library_client`, `@thzero/library_client_vue3` and `@thzero/library_common` as peers.
23
+
24
+ ## Usage
25
+
26
+ ### The store
27
+
28
+ Extend `BaseStore` with the application's own state, actions, getters and dispatchers, and export the class:
29
+
30
+ ```js
31
+ import BaseStore from '@thzero/library_client_vue3_store_pinia/store/index';
32
+
33
+ class AppStore extends BaseStore {
34
+ _initStoreConfig() {
35
+ return {
36
+ state: () => ({
37
+ launches: []
38
+ }),
39
+ actions: {
40
+ async requestLaunches(correlationId) { /* ... */ }
41
+ },
42
+ getters: {
43
+ getLaunch(id) { /* ... */ }
44
+ },
45
+ dispatcher: {
46
+ async requestLaunches(correlationId) {
47
+ return await LibraryClientUtility.$store.requestLaunches(correlationId);
48
+ }
49
+ }
50
+ };
51
+ }
52
+
53
+ _initPluginPersistConfig() {
54
+ return {
55
+ persist: {
56
+ key: '<your application>',
57
+ storage: localStorage,
58
+ paths: [ 'launchesSettings' ]
59
+ }
60
+ };
61
+ }
62
+ }
63
+
64
+ export default AppStore;
65
+ ```
66
+
67
+ Pass the class (not an instance) to `start` in `main.js`; it creates the store, installs Pinia and the persistence plugin, and makes it available as `LibraryClientUtility.$store`. Application code calls actions through `LibraryClientUtility.$store.dispatcher`.
68
+
69
+ `_initPluginPersistConfig` names the state to keep in `storage` between visits; `paths` lists the state keys. Nothing else is persisted.
70
+
71
+ ### The store service
72
+
73
+ Register the store service in the application's services boot:
74
+
75
+ ```js
76
+ import storeService from '@thzero/library_client_vue3_store_pinia/service/store/index';
77
+
78
+ class ServiceBoot extends RootServicesBoot {
79
+ _initializeStore(injector) {
80
+ return new storeService(injector);
81
+ }
82
+ }
83
+ ```
84
+
85
+ ### Modules
86
+
87
+ The `news` and `user` modules are always registered: the latest news, and the signed-in user with their settings, claims and token.
88
+
89
+ The admin modules are optional. Register them by overriding `_initModules`, which receives the function that adds a module:
90
+
91
+ ```js
92
+ import adminNews from '@thzero/library_client_vue3_store_pinia/store/admin/news';
93
+ import adminUsers from '@thzero/library_client_vue3_store_pinia/store/admin/users';
94
+
95
+ class AppStore extends BaseStore {
96
+ _initModules(addModule) {
97
+ return [
98
+ addModule('adminNews', adminNews),
99
+ addModule('adminUsers', adminUsers)
100
+ ];
101
+ }
102
+ }
103
+ ```
104
+
105
+ Each module's actions are on `LibraryClientUtility.$store.<key>`, and its dispatchers on `LibraryClientUtility.$store.dispatcher.<key>`. The admin components in [library_client_vue3](https://github.com/thzero/library_client_vue3) expect the keys `adminNews` and `adminUsers`.
106
+
107
+ ## Development
108
+
109
+ ```
110
+ npm install
111
+ npm test
112
+ npm run lint
113
+ ```
114
+
115
+ Tests use [Vitest](https://vitest.dev) with a real Pinia; the `test` folder and the configuration files are not published.
116
+
117
+ ## License
118
+
119
+ [MIT](license.md)
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@thzero/library_client_vue3_store_pinia",
3
- "version": "0.18.39",
3
+ "type": "module",
4
+ "version": "0.19.1",
4
5
  "version_major": 0,
5
- "version_minor": 18,
6
- "version_patch": 39,
7
- "version_date": "08/27/2026",
6
+ "version_minor": 19,
7
+ "version_patch": 1,
8
+ "version_date": "10/03/2026",
8
9
  "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
10
  "author": "thZero",
10
11
  "author_url": "https://www.thzero.com",
@@ -19,7 +20,9 @@
19
20
  },
20
21
  "homepage": "https://github.com/thzero/library_client_vue3_store_pinia#readme",
21
22
  "scripts": {
22
- "test": "echo \"Error: no test specified\" && exit 1"
23
+ "test": "vitest run",
24
+ "lint": "eslint .",
25
+ "lint:fix": "eslint . --fix"
23
26
  },
24
27
  "dependencies": {
25
28
  "pinia": "^4.0.3",
@@ -27,8 +30,14 @@
27
30
  "vue": "^3.5.42"
28
31
  },
29
32
  "peerDependencies": {
30
- "@thzero/library_client": "^0.18",
31
- "@thzero/library_client_vue3": "^0.18",
32
- "@thzero/library_common": "^0.18"
33
+ "@thzero/library_client": "^0.19",
34
+ "@thzero/library_client_vue3": "^0.19",
35
+ "@thzero/library_common": "^0.19"
36
+ },
37
+ "devDependencies": {
38
+ "@vitejs/plugin-vue": "^6.0.9",
39
+ "eslint": "^9",
40
+ "jsdom": "^30.1.1",
41
+ "vitest": "^5.0.1"
33
42
  }
34
43
  }
@@ -5,70 +5,80 @@ import LibraryCommonUtility from '@thzero/library_common/utility';
5
5
 
6
6
  import Response from '@thzero/library_common/response';
7
7
 
8
+ // An optional module: an app registers it from its store's _initModules as
9
+ // addModule('adminNews', adminNews)
10
+ // The dispatchers below and the admin components both expect that key.
8
11
  const store = {
9
- state: {
12
+ state: () => ({
10
13
  news: null
11
- },
14
+ }),
12
15
  actions: {
13
16
  async createAdminNews(correlationId, item) {
14
17
  const service = LibraryClientUtility.$injector.getService(LibraryClientConstants.InjectorKeys.SERVICE_ADMIN_NEWS);
15
18
  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.updateArrayByObject(this.news, item);
22
- this.$logger.debug('store.admin.news', 'setAdminNews', 'items.c', this.news, correlationId);
19
+ this.$logger.debug('store.admin.news', 'createAdminNews', 'response', response, correlationId);
20
+ if (Response.hasSucceeded(response) && response.results) {
21
+ this.$logger.debug('store.admin.news', 'createAdminNews', 'items.a', response.results, correlationId);
22
+ this.$logger.debug('store.admin.news', 'createAdminNews', 'items.b', this.news, correlationId);
23
+ // the list is null until the first search
24
+ this.news = LibraryCommonUtility.updateArrayByObject(this.news ?? [], response.results);
25
+ this.$logger.debug('store.admin.news', 'createAdminNews', 'items.c', this.news, correlationId);
23
26
  }
24
27
  return response;
25
28
  },
26
29
  async deleteAdminNews(correlationId, id) {
27
30
  const service = LibraryClientUtility.$injector.getService(LibraryClientConstants.InjectorKeys.SERVICE_ADMIN_NEWS);
28
31
  const response = await service.delete(correlationId, id);
29
- this.$logger.debug('store.admin.news', 'deleteAdminNews', 'response', response);
32
+ this.$logger.debug('store.admin.news', 'deleteAdminNews', 'response', response, correlationId);
30
33
  if (Response.hasSucceeded(response)) {
31
- this.news = LibraryCommonUtility.deleteArrayById(this.news, id);
32
- LibraryClientUtility.$store.dispatcher.news.delete(correlationId, id);
34
+ // deleteArrayById removes in place and returns nothing; assigning its
35
+ // result is what emptied the list
36
+ LibraryCommonUtility.deleteArrayById(this.news, id);
37
+ // and drop it from the public news list too
38
+ await LibraryClientUtility.$store.dispatcher.news.delete(correlationId, id);
33
39
  }
34
40
  return response;
35
41
  },
36
42
  async searchAdminNews(correlationId, params) {
37
43
  const service = LibraryClientUtility.$injector.getService(LibraryClientConstants.InjectorKeys.SERVICE_ADMIN_NEWS);
38
44
  const response = await service.search(correlationId, params);
39
- this.$logger.debug('store.admin.news', 'searchAdminNews', 'response', response);
45
+ this.$logger.debug('store.admin.news', 'searchAdminNews', 'response', response, correlationId);
40
46
  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);
47
+ this.$logger.debug('store.admin.news', 'searchAdminNews', 'list.a', list, correlationId);
48
+ this.$logger.debug('store.admin.news', 'searchAdminNews', 'list.b', this.news, correlationId);
43
49
  this.news = list;
44
- this.$logger.debug('store.admin.news', 'setAdminNewsListing', 'list.c', this.news, correlationId);
50
+ this.$logger.debug('store.admin.news', 'searchAdminNews', 'list.c', this.news, correlationId);
45
51
  },
46
52
  async updateAdminNews(correlationId, item) {
47
53
  const service = LibraryClientUtility.$injector.getService(LibraryClientConstants.InjectorKeys.SERVICE_ADMIN_NEWS);
48
54
  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.updateArrayByObject(this.news, item);
55
- this.$logger.debug('store.admin.news', 'setAdminNews', 'items.c', this.news, correlationId);
55
+ this.$logger.debug('store.admin.news', 'updateAdminNews', 'response', response, correlationId);
56
+ if (Response.hasSucceeded(response) && response.results) {
57
+ this.$logger.debug('store.admin.news', 'updateAdminNews', 'items.a', response.results, correlationId);
58
+ this.$logger.debug('store.admin.news', 'updateAdminNews', 'items.b', this.news, correlationId);
59
+ this.news = LibraryCommonUtility.updateArrayByObject(this.news ?? [], response.results);
60
+ this.$logger.debug('store.admin.news', 'updateAdminNews', 'items.c', this.news, correlationId);
56
61
  }
57
62
  return response;
58
63
  }
59
64
  },
65
+ // module actions live on $store.adminNews, not on the root $store
60
66
  dispatcher: {
61
67
  async createAdminNews(correlationId, item) {
62
- return await LibraryClientUtility.$store.createAdminNews(correlationId, item);
68
+ return await LibraryClientUtility.$store.adminNews.createAdminNews(correlationId, item);
63
69
  },
64
70
  async deleteAdminNews(correlationId, id) {
65
- return await LibraryClientUtility.$store.deleteAdminNews(correlationId, id);
71
+ return await LibraryClientUtility.$store.adminNews.deleteAdminNews(correlationId, id);
72
+ },
73
+ async searchAdminNews(correlationId, params) {
74
+ await LibraryClientUtility.$store.adminNews.searchAdminNews(correlationId, params);
66
75
  },
76
+ // the older name for searchAdminNews
67
77
  async searchNews(correlationId, params) {
68
- await LibraryClientUtility.$store.searchAdminNews(correlationId, params);
78
+ await LibraryClientUtility.$store.adminNews.searchAdminNews(correlationId, params);
69
79
  },
70
80
  async updateAdminNews(correlationId, item) {
71
- return await LibraryClientUtility.$store.updateAdminNews(correlationId, item);
81
+ return await LibraryClientUtility.$store.adminNews.updateAdminNews(correlationId, item);
72
82
  }
73
83
  }
74
84
  };
@@ -5,57 +5,61 @@ import LibraryCommonUtility from '@thzero/library_common/utility';
5
5
 
6
6
  import Response from '@thzero/library_common/response';
7
7
 
8
+ // An optional module: an app registers it from its store's _initModules as
9
+ // addModule('adminUsers', adminUsers)
10
+ // The dispatchers below and the admin components both expect that key.
8
11
  const store = {
9
- state: {
12
+ state: () => ({
10
13
  users: null
11
- },
14
+ }),
12
15
  actions: {
13
16
  async deleteAdminUser(correlationId, id) {
14
17
  const service = LibraryClientUtility.$injector.getService(LibraryClientConstants.InjectorKeys.SERVICE_ADMIN_USERS);
15
18
  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
- }
19
+ this.$logger.debug('store.admin.users', 'deleteAdminUser', 'response', response, correlationId);
20
+ // deleteArrayById removes in place and returns nothing; assigning its
21
+ // result is what emptied the list
22
+ if (Response.hasSucceeded(response))
23
+ LibraryCommonUtility.deleteArrayById(this.users, id);
22
24
  return response;
23
25
  },
24
26
  async searchAdminUsers(correlationId, params) {
25
27
  const service = LibraryClientUtility.$injector.getService(LibraryClientConstants.InjectorKeys.SERVICE_ADMIN_USERS);
26
28
  const response = await service.search(correlationId, params);
27
- this.$logger.debug('store.admin.users', 'searchAdminUsers', 'response', response);
29
+ this.$logger.debug('store.admin.users', 'searchAdminUsers', 'response', response, correlationId);
28
30
  if (Response.hasSucceeded(response)) {
29
31
  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.$logger.debug('store.admin.users', 'searchAdminUsers', 'list.a', list, correlationId);
33
+ this.$logger.debug('store.admin.users', 'searchAdminUsers', 'list.b', this.users, correlationId);
32
34
  this.users = list;
33
- this.$logger.debug('store.admin.users', 'setAdminUsersListing', 'list.c', this.users, correlationId);
35
+ this.$logger.debug('store.admin.users', 'searchAdminUsers', 'list.c', this.users, correlationId);
34
36
  }
35
37
  },
36
38
  async updateAdminUser(correlationId, item) {
37
39
  const service = LibraryClientUtility.$injector.getService(LibraryClientConstants.InjectorKeys.SERVICE_ADMIN_USERS);
38
40
  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);
41
+ this.$logger.debug('store.admin.users', 'updateAdminUser', 'response', response, correlationId);
42
+ if (Response.hasSucceeded(response) && response.results) {
43
+ this.$logger.debug('store.admin.users', 'updateAdminUser', 'items.a', response.results, correlationId);
44
+ this.$logger.debug('store.admin.users', 'updateAdminUser', 'items.b', this.users, correlationId);
45
+ // updateArrayById takes (array, id, object); called with two arguments
46
+ // it put the item in the id slot and appended undefined
47
+ this.users = LibraryCommonUtility.updateArrayByObject(this.users ?? [], response.results);
48
+ this.$logger.debug('store.admin.users', 'updateAdminUser', 'items.c', this.users, correlationId);
46
49
  }
47
50
  return response;
48
51
  }
49
52
  },
53
+ // module actions live on $store.adminUsers, not on the root $store
50
54
  dispatcher: {
51
55
  async deleteAdminUser(correlationId, id) {
52
- return await LibraryClientUtility.$store.deleteAdminUser(correlationId, id);
56
+ return await LibraryClientUtility.$store.adminUsers.deleteAdminUser(correlationId, id);
53
57
  },
54
58
  async searchAdminUsers(correlationId, params) {
55
- await LibraryClientUtility.$store.searchAdminUsers(correlationId, params);
59
+ await LibraryClientUtility.$store.adminUsers.searchAdminUsers(correlationId, params);
56
60
  },
57
61
  async updateAdminUser(correlationId, item) {
58
- return await LibraryClientUtility.$store.updateAdminUser(correlationId, item);
62
+ return await LibraryClientUtility.$store.adminUsers.updateAdminUser(correlationId, item);
59
63
  }
60
64
  }
61
65
  };
package/store/index.js CHANGED
@@ -155,11 +155,13 @@ class BaseStore {
155
155
  }
156
156
  }
157
157
 
158
- throw Error('Unknown persistance engine for Pinia store.');
158
+ throw new Error('Unknown persistance engine for Pinia store.');
159
159
  }
160
160
 
161
161
  _initModules() {
162
- return null;
162
+ // an empty list, not null: install iterates it, and an app that does not
163
+ // override this crashed while the store installed
164
+ return [];
163
165
  }
164
166
 
165
167
  _initPluginPersistConfig() {
@@ -180,8 +182,10 @@ class BaseStore {
180
182
  persistConfig.key = options.keyOverride;
181
183
  if (options && !String.isNullOrEmpty(options.keySuffix))
182
184
  persistConfig.key += options.keySuffix;
185
+ // pinia-plugin-persistedstate 4 reads `pick`; 3 read `paths`. Take the
186
+ // app's list from either, so a config written for 4 does not throw here.
183
187
  if (options && options.additionalPaths)
184
- persistConfig.pick = [ ...persistConfig.paths, ...options.additionalPaths ];
188
+ persistConfig.pick = [ ...(persistConfig.paths ?? persistConfig.pick ?? []), ...options.additionalPaths ];
185
189
  storeConfig.persist = persistConfig;
186
190
  return;
187
191
  }
@@ -203,7 +207,7 @@ class BaseStore {
203
207
  }
204
208
  }
205
209
 
206
- throw Error('Unknown persistance engine for Pinia store.');
210
+ throw new Error('Unknown persistance engine for Pinia store.');
207
211
  }
208
212
 
209
213
  _initPluginPersistConfigSetupOverride(storeConfig, persistConfig) {
@@ -261,7 +265,8 @@ class BaseStore {
261
265
  if (Response.hasFailed(response))
262
266
  return response;
263
267
  await this.setPlans(correlationId, plans);
264
- return Response.success(plans);
268
+ // Response.success(correlationId, results); the plans used to go in the correlationId slot
269
+ return Response.success(correlationId, plans);
265
270
  },
266
271
  async requestVersion(correlationId) {
267
272
  const service = LibraryClientUtility.$injector.getService(LibraryClientConstants.InjectorKeys.SERVICE_VERSION);
@@ -294,7 +299,7 @@ class BaseStore {
294
299
  return LibraryClientUtility.$store.openSource;
295
300
  },
296
301
  getPlan(correlationId, id) {
297
- if (LibraryClientUtility.$store.plans == null)
302
+ if (LibraryCommonUtility.isNull(LibraryClientUtility.$store.plans))
298
303
  return null;
299
304
  return LibraryClientUtility.$store.plans.find(plan => plan.id === id);
300
305
  }
@@ -1,40 +1,38 @@
1
1
  import LibraryClientConstants from '@thzero/library_client/constants';
2
2
 
3
3
  import LibraryClientUtility from '@thzero/library_client/utility/index';
4
+ import LibraryCommonUtility from '@thzero/library_common/utility';
4
5
 
5
6
  const store = {
6
7
  pluginPersistPaths: {
7
8
  persist: [
8
- 'news'
9
+ // the state key; this said 'news', which is not one, so nothing persisted
10
+ 'latest'
9
11
  ]
10
12
  },
11
13
  state: () => ({
12
14
  latest: null
13
15
  }),
14
16
  actions: {
17
+ async deleteNews(correlationId, id) {
18
+ LibraryCommonUtility.deleteArrayById(this.latest, id);
19
+ },
15
20
  async getLatestNews(correlationId) {
16
21
  const service = LibraryClientUtility.$injector.getService(LibraryClientConstants.InjectorKeys.SERVICE_NEWS);
17
22
  const response = await service.latest(correlationId);
18
- this.$logger.debug('store.news', 'getLatestNews', 'response', response);
19
- // commit('setLatestNews', { correlationId: correlationId, latest: response.success && response.results ? response.results.data : null });
23
+ this.$logger.debug('store.news', 'getLatestNews', 'response', response, correlationId);
20
24
  const latest = response.success && response.results ? response.results.data : null;
21
- this.$logger.debug('store.news', 'setLatest', 'item.a', latest, correlationId);
22
- this.$logger.debug('store.news', 'setLatest', 'item.b', this.latest, correlationId);
25
+ this.$logger.debug('store.news', 'getLatestNews', 'item.a', latest, correlationId);
26
+ this.$logger.debug('store.news', 'getLatestNews', 'item.b', this.latest, correlationId);
23
27
  this.latest = latest;
24
- this.$logger.debug('store.news', 'setLatest', 'item.c', this.latest, correlationId);
28
+ this.$logger.debug('store.news', 'getLatestNews', 'item.c', this.latest, correlationId);
25
29
  }
26
30
  },
27
- mutations: {
28
- // setLatestNews(state, params) {
29
- // this.$logger.debug('store.news', 'setLatest', 'item.a', params.latest, params.correlationId);
30
- // this.$logger.debug('store.news', 'setLatest', 'item.b', state.latest, params.correlationId);
31
- // state.latest = params.latest;
32
- // this.$logger.debug('store.news', 'setLatest', 'item.c', state.latest, params.correlationId);
33
- // }
34
- },
35
31
  dispatcher: {
32
+ async delete(correlationId, id) {
33
+ await LibraryClientUtility.$store.news.deleteNews(correlationId, id);
34
+ },
36
35
  async getLatest(correlationId) {
37
- // await LibraryClientUtility.$store.dispatch('getLatestNews', correlationId);
38
36
  await LibraryClientUtility.$store.news.getLatestNews(correlationId);
39
37
  }
40
38
  }
@@ -27,8 +27,10 @@ const store = {
27
27
  const service = LibraryClientUtility.$injector.getService(LibraryClientConstants.InjectorKeys.SERVICE_USER);
28
28
  const response = await service.refreshSettings(correlationId, this.user);
29
29
  this.$logger.debug('store.user', 'refreshUserSettings', 'response', response);
30
+ // setUser(correlationId, user): without the correlationId the user was
31
+ // set to undefined
30
32
  if (Response.hasSucceeded(response) && response.results)
31
- this.setUser(response.results);
33
+ await this.setUser(correlationId, response.results);
32
34
  return response;
33
35
  },
34
36
  async resetUser(correlationId) {
@@ -76,12 +78,12 @@ const store = {
76
78
  this.settings = LibraryClientVueUtility.settings().mergeUser(correlationId, settings);
77
79
  return Response.success(correlationId, this.settings);
78
80
  },
79
- async setUserTheme(correlationId, isLoggedIn) {
81
+ async setUserTheme(correlationId, theme) {
80
82
  this.theme = theme;
81
83
  },
82
84
  async setUserTokenResult(correlationId, tokenResult) {
83
85
  this.$patch({
84
- tokenResult: null,
86
+ tokenResult: tokenResult ?? null,
85
87
  token: tokenResult ? tokenResult.token : null
86
88
  });
87
89
  }
@@ -91,7 +93,8 @@ const store = {
91
93
  return LibraryClientUtility.$store.user.user;
92
94
  },
93
95
  getUserTheme (correlationId) {
94
- return LibraryClientUtility.$store.theme;
96
+ // theme lives on the user module, not the root store
97
+ return LibraryClientUtility.$store.user.theme;
95
98
  },
96
99
  getUserSettings(correlationId) {
97
100
  if (LibraryClientUtility.$store.user.settings) // TODO: userRef