1.0.6 • Published 3 years ago

@jswork/pinia-plugin-persist v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
3 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

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago