This commit is contained in:
Viet An
2026-06-03 15:34:53 +07:00
parent c04abb452f
commit 8e2dd06def
8 changed files with 480 additions and 21 deletions

View File

@@ -14,33 +14,17 @@ export const useStore = defineStore("maindev", {
branch: {},
rights: [],
product: [],
selectedImeis: [],
}),
actions: {
commit(name, data) {
// console.trace("commit", name, data);
this[name] = data;
},
updateProduct(products) {
this.product = products;
},
updateSingleProduct(updatedProduct) {
const index = this.product.findIndex((p) => p.id === updatedProduct.id);
if (index !== -1) {
this.product[index] = updatedProduct;
} else {
this.product.push(updatedProduct);
}
},
removeProduct(productId) {
this.product = this.product.filter((p) => p.id !== productId);
},
},
persist: {
pick: ["token", "login", "lang"],
pick: ["token", "login", "lang", "selectedImeis"],
storage: piniaPluginPersistedstate.localStorage(),
},
});