refactor: create function changeStatus
This commit is contained in:
parent
d9c4de6315
commit
ec230fe472
1 changed files with 12 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ import {
|
||||||
QuotationPaymentData,
|
QuotationPaymentData,
|
||||||
QuotationStats,
|
QuotationStats,
|
||||||
PaymentPayload,
|
PaymentPayload,
|
||||||
|
QuotationStatus,
|
||||||
} from './types';
|
} from './types';
|
||||||
import { PaginationResult } from 'src/types';
|
import { PaginationResult } from 'src/types';
|
||||||
import { AxiosProgressEvent } from 'axios';
|
import { AxiosProgressEvent } from 'axios';
|
||||||
|
|
@ -81,6 +82,16 @@ export const useQuotationStore = defineStore('quotation-store', () => {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function changeStatus(quotationId: string, status: QuotationStatus) {
|
||||||
|
const res = await api.put(`/quotation/${quotationId}`, {
|
||||||
|
quotationStatus: status,
|
||||||
|
});
|
||||||
|
if (res.status < 400) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
async function editQuotation(data: QuotationPayload & { id: string }) {
|
async function editQuotation(data: QuotationPayload & { id: string }) {
|
||||||
const { _count, ...payload } = data;
|
const { _count, ...payload } = data;
|
||||||
const res = await api.put(`/quotation/${data.id}`, {
|
const res = await api.put(`/quotation/${data.id}`, {
|
||||||
|
|
@ -123,6 +134,7 @@ export const useQuotationStore = defineStore('quotation-store', () => {
|
||||||
createQuotation,
|
createQuotation,
|
||||||
editQuotation,
|
editQuotation,
|
||||||
deleteQuotation,
|
deleteQuotation,
|
||||||
|
changeStatus,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue