import { ContactsFormType } from "@/lib/get-contacts-form-details"; import { SponsorFormType } from "@/lib/get-sponsor-form-details"; import { StandFormType } from "@/lib/get-stend-form-details"; import axios from "axios"; import { ContactsPageType } from "./types/contacts.type"; import { LangState } from "@/store/lang"; import { StatsType } from "@/hooks/tanstack/use-stats"; import { HomeContactsType } from "./types/home-contacts.type"; import { StaticType } from "@/hooks/tanstack/use-static-words"; import { IndustriesType } from "@/hooks/tanstack/use-industries"; import { TimeType } from "@/hooks/tanstack/use-exhibition-time"; import { PartnersType } from "@/hooks/tanstack/use-partners"; import { NewsInnerType, NewsType } from "./types/news.type"; import { ParticipantsType } from "./types/participants.type"; import { PhotoTypes } from "./types/photo.type"; import { DesignersType } from "./types/designers.type"; import { VideoTypes } from "./types/videos.type"; const axios_url = axios.create({ baseURL: "https://turkmentextile.turkmenexpo.com/app/api/v1/", }); export const postStend = async (data: StandFormType): Promise => { const res = axios_url.post(`book_stand_form`, data); return (await res).status === 201; }; export const postB2b = async (data: FormData): Promise => { const res = axios_url.post(`form`, data); return (await res).status === 201; }; export const postSponsor = async (data: SponsorFormType): Promise => { const res = axios_url.post(`become_sponsor_form`, data); return (await res).status === 201; }; export const postContact = async (data: ContactsFormType): Promise => { const res = axios_url.post(`contact_form`, data); return (await res).status === 201; }; export const postSubscribe = async (data: { email: string }) => { const res = axios_url.post("subscribe_news_form", data); return (await res).status === 201; }; export const getStaticWords = async (lang: LangState["lang"], id: string) => { const data = axios_url.get(`pages/${id}`, { headers: { "Accept-Language": lang, }, }); return data; }; export const getPartners = async (lang: LangState["lang"]) => { const data = axios_url.get("partners", { headers: { "Accept-Language": lang, }, }); return data; }; export const getStats = async (lang: LangState["lang"]) => { const data = axios_url.get("stats", { headers: { "Accept-Language": lang, }, }); return data; }; export const getContacts = async (lang: LangState["lang"]) => { const data = axios_url.get("contact_info", { headers: { "Accept-Language": lang, }, }); return data; }; export const getHomeContacts = async (lang: LangState["lang"]) => { const data = axios_url.get("contact_data", { headers: { "Accept-Language": lang, }, }); return data; }; export const getIndustries = async (lang: LangState["lang"]) => { const data = axios_url.get(`industries`, { headers: { "Accept-Language": lang, }, }); return data; }; export const getExhibitionTime = async (lang: LangState["lang"]) => { const data = axios_url.get(`exhibition_time`, { headers: { "Accept-Language": lang, }, }); return data; }; export const getNews = async (lang: "ru" | "en") => { const data = axios_url.get(`news`, { headers: { "Accept-Language": lang, }, }); return data; }; export const getNewsInner = async (id: number, lang: string) => { const data = axios_url.get(`news/${id}`, { headers: { "Accept-Language": lang, }, }); return data; }; export const getParticipants = async (lang: LangState["lang"]) => { const data = axios_url("participants", { headers: { "Accept-Language": lang, }, }); return data; }; export const getPhotos = async (id: number) => { const data = axios_url("photos/category/" + id); return data; }; export const getVideos = async (id: number) => { const data = axios_url("videos/category/" + id); return data; }; export const getSponsors = async (lang: LangState["lang"]) => { const data = axios_url("sponsors_and_partners", { headers: { "Accept-Language": lang, }, }); return data; }; export const getDesigners = async (lang: LangState["lang"], id: number) => { const data = axios_url("designers/category/" + id, { headers: { "Accept-Language": lang, }, }); return data; };