Files
info-target-mobile/screens/e-services/lib/api.ts
Samandar Turgunboyev 754f11804a government ui complated
2026-02-05 16:09:03 +05:00

31 lines
952 B
TypeScript

import httpClient from '@/api/httpClient';
import { API_URLS } from '@/api/URLs';
import { AxiosResponse } from 'axios';
import { GovermentCategoryData, GovermentServiceData } from './types';
export const eservices_api = {
async list(params: {
page: number;
page_size: number;
category?: number;
}): Promise<AxiosResponse<GovermentServiceData>> {
const res = await httpClient.get(API_URLS.Goverment_Service, { params });
return res;
},
async category(): Promise<AxiosResponse<GovermentCategoryData>> {
const res = await httpClient.get(API_URLS.Goverment_Category);
return res;
},
};
export const search_api = {
search: async (query: string) => {
const res = await fetch(`https://server.myorg.uz/search?query=${encodeURIComponent(query)}`, {
headers: { Access: 'Bearer 12opNgslS4S2DDllcsnPKD789D2ek2HJhH23C' },
});
if (!res.ok) throw new Error('Search error');
return res.json();
},
};