| Total Complexity | 2 |
| Complexity/F | 1 |
| Lines of Code | 20 |
| Function Count | 2 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import axios, { AxiosResponse } from 'axios'; |
||
| 2 | import { mapServiceDtoToService } from '../utils/helpers/MappingHelpers'; |
||
| 3 | import { EnvironmentStateDto, ServiceDto } from './api.types'; |
||
| 4 | import { config } from './config'; |
||
| 5 | |||
| 6 | const baseURL = config.get('BASE_PATH'); |
||
| 7 | const axiosWithBaseUrl = axios.create({ baseURL }); |
||
| 8 | |||
| 9 | export function getServicesRequest(env: string) { |
||
| 10 | return axiosWithBaseUrl |
||
| 11 | .get<EnvironmentStateDto>('/interrelationship/' + env) |
||
| 12 | .then((response: AxiosResponse<EnvironmentStateDto>) => |
||
| 13 | response.data.serviceContracts.map((service: ServiceDto) => mapServiceDtoToService(service)) |
||
| 14 | ); |
||
| 15 | } |
||
| 16 | |||
| 17 | export function getEnvironmentsRequest() { |
||
| 18 | return axiosWithBaseUrl.get<string[]>('/environments').then((response: AxiosResponse<string[]>) => response.data); |
||
| 19 | } |
||
| 20 |