fix(user): stop Pinia stores from running before the app boots

Calling useStore at import time crashed startup, and the dev service worker was registered as a classic script.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-06 11:42:23 +03:30
co-authored by Cursor
parent 0f50ec315c
commit 0547b9ebaa
4 changed files with 193 additions and 163 deletions
+5 -3
View File
@@ -5,12 +5,14 @@ import type {Ref, UnwrapRef} from "vue";
import type {Transaction} from "@/models/transaction";
import {useUserStore} from "@/store/userStore";
const userStore = useUserStore()
function customerOrderBase() {
return `/customer${useUserStore().isSingle ? '/single' : ''}/order`
}
export const createOrder = async (obj: Order): Promise<any> => {
return await useAxios.post<Order>(`/customer${!userStore.isSingle ? '' : '/single'}/order`, obj)
return await useAxios.post<Order>(customerOrderBase(), obj)
}
export const getOrders = async (tbl: Ref<UnwrapRef<TableInput>>): Promise<TableOutput<Transaction>> => {
return await useAxios.post<TableOutput<Order>>(`/customer${!userStore.isSingle ? '' : '/single'}/order/table`, tbl)
return await useAxios.post<TableOutput<Order>>(`${customerOrderBase()}/table`, tbl)
}
+1 -2
View File
@@ -152,7 +152,6 @@ export const justNumber = () => {
message: 'لطفا اطلاعات را به صورت عدد و نقطه وارد کنید'
}
}
const walletCash = useWalletStore()
let priceP = 0
let methodP = 'cash'
let amountP =0
@@ -173,7 +172,7 @@ const checkNumber = async (_rule: Rule, value: number | string) => {
return Promise.reject('استفاده از اعداد اعشاری مجاز نمی باشد')
}
if (isBuyP){
const availableCash = getCashWalletBalance(walletCash?.walletInfo)
const availableCash = getCashWalletBalance(useWalletStore().walletInfo)
if (!availableCash && isCashLikeDealMethod(methodP)){
return Promise.reject(getInsufficientCashWalletMessage(groupTypeP))
}