import appConfig from '../config/appConfig.json';

export function fetchAuth(endpoint, body) {
  const request = {
    method: endpoint.method,
    headers: {
      Authorization: appConfig.appSecret,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(body)
  };

  return fetch(endpoint.url, request).then(res => res.json());
}
