@thzero/library_client_vue3_store_pinia
| Install | |
|---|---|
npm install @thzero/library_client_vue3_store_pinia |
|
| Latest Version: | 0.19.5 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Oct 10, 2026 |
| Links: | GitHub · npm |
library_client_vue3_store_pinia
The application store for library_client_vue3, on Pinia, with persistence through pinia-plugin-persistedstate.
Requirements
NodeJs
NodeJs version 22+.
Installation
npm install @thzero/library_client_vue3_store_pinia
It installs pinia and pinia-plugin-persistedstate, and requires @thzero/library_client, @thzero/library_client_vue3 and @thzero/library_common as peers.
Usage
The store
Extend BaseStore with the application's own state, actions, getters and dispatchers, and export the class:
import BaseStore from '@thzero/library_client_vue3_store_pinia/store/index';
class AppStore extends BaseStore {
_initStoreConfig() {
return {
state: () => ({
launches: []
}),
actions: {
async requestLaunches(correlationId) { /* ... */ }
},
getters: {
getLaunch(id) { /* ... */ }
},
dispatcher: {
async requestLaunches(correlationId) {
return await LibraryClientUtility.$store.requestLaunches(correlationId);
}
}
};
}
_initPluginPersistConfig() {
return {
persist: {
key: '<your application>',
storage: localStorage,
paths: [ 'launchesSettings' ]
}
};
}
}
export default AppStore;
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.
_initPluginPersistConfig names the state to keep in storage between visits; paths lists the state keys. Nothing else is persisted.
The store service
Register the store service in the application's services boot:
import storeService from '@thzero/library_client_vue3_store_pinia/service/store/index';
class ServiceBoot extends RootServicesBoot {
_initializeStore(injector) {
return new storeService(injector);
}
}
Modules
The news and user modules are always registered: the latest news, and the signed-in user with their settings, claims and token.
The admin modules are optional. Register them by overriding _initModules, which receives the function that adds a module:
import adminNews from '@thzero/library_client_vue3_store_pinia/store/admin/news';
import adminUsers from '@thzero/library_client_vue3_store_pinia/store/admin/users';
class AppStore extends BaseStore {
_initModules(addModule) {
return [
addModule('adminNews', adminNews),
addModule('adminUsers', adminUsers)
];
}
}
Each module's actions are on LibraryClientUtility.$store.<key>, and its dispatchers on LibraryClientUtility.$store.dispatcher.<key>. The admin components in library_client_vue3 expect the keys adminNews and adminUsers.
Development
npm install
npm test
npm run lint
Tests use Vitest with a real Pinia; the test folder and the configuration files are not published.
License
Related Packages
An opinionated library of common functionality to bootstrap a VueJs based SPA ap...
An opinionated library of common functionality to bootstrap a VueJs 3.0 based SP...
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.19.5 | ^3.5.43 | MIT | |
| 0.19.4 | ^3.5.43 | MIT | |
| 0.19.3 | ^3.5.43 | MIT | |
| 0.19.2 | ^3.5.43 | MIT | |
| 0.19.1 | ^3.5.42 | MIT | |
| 0.18.39 | ^3.5.42 | MIT | |
| 0.18.36 | ^3.5.38 | MIT | |
| 0.18.35 | ^3.5.32 | MIT | |
| 0.18.34 | ^3.5.32 | MIT | |
| 0.18.33 | ^3.5.32 | MIT | |
| 0.18.32 | ^3.5.29 | MIT | |
| 0.18.31 | ^3.5.27 | MIT | |
| 0.18.28 | ^3.5.27 | MIT | |
| 0.18.27 | ^3.5.27 | MIT | |
| 0.18.26 | ^3.5.26 | MIT | |
| 0.18.25 | ^3.5.25 | MIT | |
| 0.18.24 | ^3.5.24 | MIT | |
| 0.18.23 | ^3.5.22 | MIT | |
| 0.18.22 | ^3.5.21 | MIT | |
| 0.18.21 | ^3.5.21 | MIT | |
| 0.18.20 | ^3.5.18 | MIT | |
| 0.18.19 | ^3.5.17 | MIT | |
| 0.18.18 | ^3.5.17 | MIT | |
| 0.18.17 | ^3.5.14 | MIT | |
| 0.18.16 | ^3.5.14 | MIT | |
| 0.18.15 | ^3.5.13 | MIT | |
| 0.18.14 | ^3.5.13 | MIT | |
| 0.18.12 | ^3.5.13 | MIT | |
| 0.18.11 | ^3.5.13 | MIT | |
| 0.18.10 | ^3.5.13 | MIT |
Showing the latest 30 of 72. See every release on npm
