From f149aa15edd368e4366ea23a29e178d45a32c67f Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Wed, 30 Oct 2024 11:03:59 +0700 Subject: [PATCH] feat: add ref type for data --- src/stores/payment/index.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/stores/payment/index.ts b/src/stores/payment/index.ts index 8e9bf34c..1f465d45 100644 --- a/src/stores/payment/index.ts +++ b/src/stores/payment/index.ts @@ -6,16 +6,14 @@ import { Invoice, InvoicePayload, Payment, Receipt } from './types'; import { manageAttachment } from '../utils'; export const usePayment = defineStore('payment-store', () => { - const data = ref<{}[]>([]); + const data = ref([]); const page = ref(1); const pageMax = ref(1); const pageSize = ref(30); async function getPayment(id: string) { const res = await api.get(`/payment/${id}`); - if (res.status >= 400) return null; - return res.data; } @@ -28,9 +26,7 @@ export const usePayment = defineStore('payment-store', () => { const res = await api.get>('/payment', { params: opts, }); - if (res.status >= 400) return null; - return res.data; } @@ -67,7 +63,7 @@ export const usePayment = defineStore('payment-store', () => { }); export const useReceipt = defineStore('receipt-store', () => { - const data = ref<{}[]>([]); + const data = ref([]); const page = ref(1); const pageMax = ref(1); const pageSize = ref(30); @@ -91,7 +87,6 @@ export const useReceipt = defineStore('receipt-store', () => { }); if (res.status >= 400) return null; - return res.data; } @@ -131,7 +126,6 @@ export const useInvoice = defineStore('invoice-store', () => { }); if (res.status >= 400) return null; - return res.data; }