'use strict';
const fetch = require('node-fetch');
const FormData = require('form-data');

module.exports = (config) => {
  return {
    retrieve: () => {
      let form = new FormData();
      form.append('username', config.username);
      form.append('password', config.password);
      const url = config.apiURL + '/fetch_api_key';
      return fetch(url, {
        method: 'POST',
        body: form
      }).then(res => res.json());
    }
  };
};

@@ -11,35 +11,62 @@
 t';%0A
-const fetch = require('node
+require('es6-promise').polyfill();%0Arequire('isomorphic
 -fet

use isomorphic fetch for getting api key