Untitled
unknown
plain_text
10 months ago
635 B
5
Indexable
import { createStore } from "vuex";
import authModule from "./modules/auth"; // Importă modulul de autentificare
const store = createStore({
modules: {
auth: authModule, // Adaugă modulul de autentificare
},
});
// Reîncarcă starea din localStorage (dacă este cazul)
if (localStorage.getItem("state")) {
const state = JSON.parse(localStorage.getItem("state"));
store.replaceState(Object.assign(store.state, state));
}
// Ascultă modificările în store pentru a salva starea în localStorage
store.subscribe((mutation, state) => {
localStorage.setItem("state", JSON.stringify(state));
});
export default store;
Editor is loading...
Leave a Comment