1.0.6 • Published 2 years ago

@jswork/pinia-plugin-persist v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

pinia-plugin-persist

Persist pinia state data storages.

version license size download

installation

npm install @jswork/pinia-plugin-persist

usage

import PiniaPluginPersist from '@jswork/pinia-plugin-persist';

// ======== main.js  ======
export function createApp() {
  const app = createSSRApp(App);
  const pinia = createPinia();

  // Attach storage
  app.$storage = nx.$storage;
  pinia.use(PiniaPluginPersist);
  //...
}

// ======== stores/auth.js ======
import { defineStore } from "pinia";

export default defineStore("auth", {
  state: () => ({ profile: null, user: null, other: null }),
  persist: {
    keys: ["profile", "user"]
  },
});

license

Code released under the MIT license.

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago