0
1
Fork 0

Create a constant for store local storage order name

This commit is contained in:
William Buezas 2024-09-10 17:07:29 -03:00
parent 418911b903
commit 93e739f35c
1 changed files with 4 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import { i18n } from 'src/boot/i18n';
import { useQuasar } from 'quasar';
const { notify } = useNotify();
const storageOrderName = 'hederaBasket';
export const useAppStore = defineStore('hedera', {
state: () => ({
@ -72,7 +73,7 @@ export const useAppStore = defineStore('hedera', {
},
getBasketOrderId() {
this.basketOrderId = localStorage.getItem('hederaBasket');
this.basketOrderId = localStorage.getItem(storageOrderName);
},
async checkOrder(orderId) {
@ -130,13 +131,13 @@ export const useAppStore = defineStore('hedera', {
loadIntoBasket(orderId) {
if (this.basketOrderId !== orderId) {
this.basketOrderId = orderId;
localStorage.setItem('hederaBasket', orderId);
localStorage.setItem(storageOrderName, orderId);
notify('orderLoadedIntoBasket', 'positive');
}
},
unloadOrder() {
localStorage.removeItem('hederaBasket');
localStorage.removeItem(storageOrderName);
this.basketOrderId = null;
}
},