This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
Replies: 1 comment 1 reply
-
I feel that it has become complicated instead. import { defineStore } from "pinia";
import { reactive } from "vue";
// Setup Store https://pinia.vuejs.org/zh/core-concepts/index.html#setup-stores
export const useLoggedInStore = defineStore(
"loggedIn",
() => {
const user = reactive({ data: { id: String } });
function login(loginUser: any) {
user.data = loginUser;
}
function isLogin() {
return typeof user.data.id !== "function";
}
return {
user,
login,
isLogin,
};
},
// Look here!
{
// https://seb-l.github.io/pinia-plugin-persist/basic-usage.html#basic-usage
persist: {
enabled: true,
// strategies: [{ storage: localStorage, key: "loggedIn", paths: ["user"] }],
},
}
); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a store write in composition api that I want to persist. What would the syntax be? and can we add an example to the documentation?
Beta Was this translation helpful? Give feedback.
All reactions