2021-10-06 20:47:50 +00:00
|
|
|
import camel from 'camelcase-keys'
|
2021-04-01 15:46:13 +00:00
|
|
|
|
|
|
|
export interface EtjanstResponse {
|
|
|
|
Success: boolean
|
|
|
|
Error: string | null
|
|
|
|
Data: any | any[]
|
|
|
|
}
|
|
|
|
|
|
|
|
export const etjanst = (response: EtjanstResponse): any | any[] => {
|
|
|
|
if (!response.Success) {
|
|
|
|
throw new Error(response.Error || '')
|
|
|
|
}
|
|
|
|
return camel(response.Data, { deep: true })
|
|
|
|
}
|