feat: add ref type for data
This commit is contained in:
parent
22307ed2fb
commit
f149aa15ed
1 changed files with 2 additions and 8 deletions
|
|
@ -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<Payment[]>([]);
|
||||
const page = ref<number>(1);
|
||||
const pageMax = ref<number>(1);
|
||||
const pageSize = ref<number>(30);
|
||||
|
||||
async function getPayment(id: string) {
|
||||
const res = await api.get<Payment>(`/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<PaginationResult<Payment>>('/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<Receipt[]>([]);
|
||||
const page = ref<number>(1);
|
||||
const pageMax = ref<number>(1);
|
||||
const pageSize = ref<number>(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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue