erp-platform/ui/src/proxy/form/form.service.ts
Sedat ÖZTÜRK e1a9562b22 init project
2025-05-06 09:45:49 +03:00

38 lines
825 B
TypeScript

import apiService from '@/services/api.service'
import { GridDto } from './models'
import { AxiosError, Method } from 'axios'
import { URLSearchParams } from 'url'
export const getList = (data: Record<string, string>) => {
try {
return apiService.fetchData<GridDto>({
method: 'GET',
url: '/api/app/list-form-select/grid',
params: data,
})
} catch (error) {
if (error instanceof AxiosError) {
return error.response?.data
}
}
}
export const dynamicFetch = (
url: string,
method: Method | string,
params?: URLSearchParams | any,
data?: any,
) => {
try {
return apiService.fetchData({
method,
url: '/api/app/' + url,
params,
data,
})
} catch (error) {
if (error instanceof AxiosError) {
return error.response?.data
}
}
}