15 lines
326 B
TypeScript
15 lines
326 B
TypeScript
import camel from 'camelcase-keys'
|
|
|
|
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 })
|
|
}
|