1

i try to call api with superagent in my react app like this :

import superagentPromise from 'superagent-promise';
import _superagent from 'superagent';
import { Base64 } from 'js-base64';

const API_ROOT = 'https//myapiurl.com/api';

const superagent = superagentPromise(_superagent, global.Promise);

  login: (username, password) => {
    let encrypt = Base64.encode(`${username}:${password}`);
    return superagent.get(`${API_ROOT}/initSession`)
          .use(tokenPlugin).set('Authorization', `Basic ${encrypt}`)
          .then(responseBody)
  }

but with any call, react add ' http://localhost:8001 ' to my call, in the chrome debug i got " Request URL http://localhost:8001/https//myapiurl.com/api/initSession'

i have'nt any idea, two day i search solution...

thank's in advance.

Dd Vivi
  • 11
  • 3

0 Answers0