All files / lib/apis/core index.ts

0% Statements 0/8
100% Branches 0/0
100% Functions 0/0
0% Lines 0/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41                                                                                 
/* eslint-disable no-param-reassign */
import axios from 'axios';
import {
  AuthApi,
  Configuration as CoreInterfaceConfiguration
} from '@uniquegood/realworld-core-interface';
import { getMe, getMeForDevelopment } from '@lib/apis/core/getMe';
import postPreferences, { postPreferencesForDevelopment } from '@lib/apis/core/postPreferences';
 
export const CORE_SERVER_HOST = {
  production: 'api.realworld.to',
  development: 'api-test.realworld.to'
};
 
const axiosInstance = axios.create();
 
const configuration = new CoreInterfaceConfiguration({
  basePath: `https://${CORE_SERVER_HOST.production}`
});
export const coreAuthApi = new AuthApi(configuration, undefined, axiosInstance);
 
const configurationForDevelopment = new CoreInterfaceConfiguration({
  basePath: `https://${CORE_SERVER_HOST.development}`
});
 
export const coreAuthDevelopmentApi = new AuthApi(
  configurationForDevelopment,
  undefined,
  axiosInstance
);
 
export const coreDirectApi = {
  postPreferences,
  getMe
};
 
export const coreDirectDevelopmentApi = {
  postPreferences: postPreferencesForDevelopment,
  getMe: getMeForDevelopment
};