last push

This commit is contained in:
nabijonovdavronbek619@gmail.com
2026-04-08 20:15:28 +05:00
parent f18d35c29b
commit dfb8d3bdbc
26 changed files with 634 additions and 281 deletions

View File

@@ -21,7 +21,7 @@ const INITIAL_FORM: PlagiarismFormState = {
file: null,
certificate: true,
text: '',
type: 'boshqa',
type: 0,
};
const PRICE: PriceCalculate = {
@@ -71,6 +71,7 @@ export function usePlagiarismForm() {
const priceInfo: PriceCalculate = {
total_price: resdata?.total_price || 0,
discount: resdata?.discount || 0,
certificate: resdata?.certificate || 0,
service_fee: resdata?.service_fee || 0,
};
setPrices(priceInfo);
@@ -90,7 +91,7 @@ export function usePlagiarismForm() {
const payment = useMutation({
mutationKey: ['payload'],
mutationFn: ({ order_id }: { order_id: number }) =>
apiRequest<{ payment_link: string }>('POST', links.payment(order_id)),
apiRequest<{ payment_link: string }>('POST', links.demo_pay(order_id)),
onSuccess: (res) => {
console.log('payment res: ', res);
window.open(res.data.payment_link, '_self');
@@ -116,9 +117,9 @@ export function usePlagiarismForm() {
setErrors((prev) => ({ ...prev, file: undefined }));
}, []);
const setOption = useCallback((option: string) => {
setForm((prev) => ({ ...prev, document_type: option }));
setErrors((prev) => ({ ...prev, document_type: undefined }));
const setOption = useCallback((option: number) => {
setForm((prev) => ({ ...prev, type: option }));
setErrors((prev) => ({ ...prev, type: undefined }));
}, []);
const toggleCertificate = useCallback(() => {
@@ -150,7 +151,7 @@ export function usePlagiarismForm() {
fd.append('text', form.text || '');
fd.append('file', form.file!);
fd.append('certificate', String(form.certificate));
fd.append('type', form.type);
fd.append('type', String(form.type));
console.log('sended data: ', fd);
checkdocumentRequest.mutate(fd);
},