feat: function api get flow account of payment

This commit is contained in:
Thanaphon Frappet 2024-12-18 10:00:51 +07:00
parent e8cd7e2df8
commit 201ddfdcfa

View file

@ -2,7 +2,13 @@ import { ref } from 'vue';
import { defineStore } from 'pinia';
import { api } from 'src/boot/axios';
import { PaginationResult } from 'src/types';
import { Invoice, InvoicePayload, Payment, Receipt } from './types';
import {
Invoice,
InvoicePayload,
Payment,
Receipt,
PaymentFlowAccount,
} from './types';
import { manageAttachment } from '../utils';
export const usePayment = defineStore('payment-store', () => {
@ -17,6 +23,15 @@ export const usePayment = defineStore('payment-store', () => {
return res.data;
}
async function getFlowAccount(id: string) {
const res = await api.get<PaymentFlowAccount>(
`/payment/${id}/flow-account`,
);
if (res.status >= 400) return null;
console.log(res);
return res.data;
}
async function getPaymentList(opts?: {
page?: number;
pageSize?: number;
@ -58,6 +73,8 @@ export const usePayment = defineStore('payment-store', () => {
updatePayment,
deletePayment,
getFlowAccount,
...manageAttachment(api, 'payment'),
};
});