feat: add fetch payment fn
This commit is contained in:
parent
14ab67ccfe
commit
aff61a50c4
1 changed files with 21 additions and 3 deletions
|
|
@ -2,7 +2,7 @@ import { ref } from 'vue';
|
|||
import { defineStore } from 'pinia';
|
||||
import { api } from 'src/boot/axios';
|
||||
import { PaginationResult } from 'src/types';
|
||||
import { Invoice, InvoicePayload } from './types';
|
||||
import { Invoice, InvoicePayload, Payment } from './types';
|
||||
|
||||
export const usePayment = defineStore('payment-store', () => {
|
||||
const data = ref<{}[]>([]);
|
||||
|
|
@ -10,9 +10,27 @@ export const usePayment = defineStore('payment-store', () => {
|
|||
const pageMax = ref<number>(1);
|
||||
const pageSize = ref<number>(30);
|
||||
|
||||
async function getPayment() {}
|
||||
async function getPayment(id: string) {
|
||||
const res = await api.get<Payment>(`/payment/${id}`);
|
||||
|
||||
async function getPaymentList() {}
|
||||
if (res.status >= 400) return null;
|
||||
|
||||
return res.data;
|
||||
}
|
||||
async function getPaymentList(opts?: {
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
query?: string;
|
||||
quotationId?: string;
|
||||
}) {
|
||||
const res = await api.get<PaginationResult<Payment>>('/payment', {
|
||||
params: opts,
|
||||
});
|
||||
|
||||
if (res.status >= 400) return null;
|
||||
|
||||
return res.data;
|
||||
}
|
||||
|
||||
return {
|
||||
data,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue