skolplattformen-backup/libs/api-skolplattformen/lib/parse/etjanst.ts

15 lines
326 B
TypeScript
Raw Normal View History

2021-10-06 20:47:50 +00:00
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 })
}