forked from verdnatura/hedera-web
Create a constant for store local storage order name
This commit is contained in:
parent
418911b903
commit
93e739f35c
|
@ -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;
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue