system-praktyk-front/src/api/type.ts
2020-10-04 14:18:25 +02:00

13 lines
475 B
TypeScript

import { InternshipType } from "@/data";
import { axios } from "@/api/index";
import { InternshipTypeDTO, internshipTypeDtoTransformer } from "@/api/dto/type";
const AVAILABLE_INTERNSHIP_TYPES = '/internshipTypes';
export async function available(): Promise<InternshipType[]> {
const response = await axios.get<InternshipTypeDTO[]>(AVAILABLE_INTERNSHIP_TYPES);
const dtos = response.data;
return dtos.map(dto => internshipTypeDtoTransformer.transform(dto));
}