feat: catalog read cache (api + user apps) and clearer Zarrin accounting errors

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
s.esmaeili
2026-10-11 14:31:32 +03:30
co-authored by Cursor
parent 561addc676
commit 574fa1b4aa
53 changed files with 1241 additions and 401 deletions
@@ -107,7 +107,9 @@ import Spinner from '../../components/Spinner.vue'
import SectionHead from '../../components/home/SectionHead.vue'
import { jdate, price } from '../../utils/filters'
import { useSessionStore } from '../../stores/session'
import { api, type LedgerEntrySummary } from '../../api/client'
import type { LedgerEntrySummary } from '../../api/client'
import { useCachedReads } from '../../api/cachedReads'
import { KEYS } from '../../stores/queryCache'
const SOURCE_LABELS: Record<string, string> = {
ORDER_STOCK: 'سفارش',
@@ -121,9 +123,10 @@ const SOURCE_LABELS: Record<string, string> = {
}
const session = useSessionStore()
const reads = useCachedReads()
const loading = ref(false)
const entries = ref<LedgerEntrySummary[]>([])
const entries = ref<LedgerEntrySummary[]>(reads.peek<LedgerEntrySummary[]>(KEYS.ledger) ?? [])
const showPopUp = ref(false)
const activeEntry = ref<LedgerEntrySummary | null>(null)
@@ -141,9 +144,9 @@ const openEntry = (item: LedgerEntrySummary) => {
onMounted(async () => {
if (!session.isLoggedIn) return
loading.value = true
loading.value = reads.peek(KEYS.ledger) === undefined
try {
entries.value = await api.getMyLedgerEntries()
entries.value = await reads.myLedgerEntries()
} finally {
loading.value = false
}