fitst commit
This commit is contained in:
32
screens/create-ads/lib/api.ts
Normal file
32
screens/create-ads/lib/api.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import httpClient from '@/api/httpClient';
|
||||
import { API_URLS } from '@/api/URLs';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { CreateAdsResponse, PriceCalculationRes } from './types';
|
||||
|
||||
export const price_calculation = {
|
||||
async calculation(params: {
|
||||
country: string;
|
||||
region: string;
|
||||
district: string | 'all';
|
||||
letters: string | any;
|
||||
types: string;
|
||||
}): Promise<AxiosResponse<PriceCalculationRes>> {
|
||||
const res = await httpClient.get(API_URLS.Price_Calculation, { params });
|
||||
return res;
|
||||
},
|
||||
|
||||
async ad(body: FormData): Promise<AxiosResponse<CreateAdsResponse>> {
|
||||
const res = await httpClient.post(API_URLS.Add_Ads, body, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
});
|
||||
return res;
|
||||
},
|
||||
async payment(body: { return_url: string; adId: number; paymentType: 'payme' | 'referral' }) {
|
||||
const res = await httpClient.post(API_URLS.Payment_Ads(body.paymentType, body.adId), {
|
||||
return_url: body.return_url,
|
||||
});
|
||||
return res;
|
||||
},
|
||||
};
|
||||
21
screens/create-ads/lib/types.ts
Normal file
21
screens/create-ads/lib/types.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
export interface PriceCalculationRes {
|
||||
country: string;
|
||||
region: string;
|
||||
district: string;
|
||||
letters: string[];
|
||||
one_person_price: number;
|
||||
user_count: number;
|
||||
total_price: number;
|
||||
user_ids: number[];
|
||||
}
|
||||
|
||||
export interface CreateAdsResponse {
|
||||
status: boolean;
|
||||
data: {
|
||||
description: string;
|
||||
id: number;
|
||||
phone_number: string;
|
||||
title: string;
|
||||
total_price: number;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user