Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

131
Views
add prefix to url path

This is my call_api.js

import request from 'superagent';
import base from '../base';
import getToken from '../../utils/getToken';

export default (id) => {
    const token = getToken();
    return base(
        request
            .put(`/api/client/workspace/${id}/leave`)
            .set('Authorization', `Bearer ${token}`)
    );
};

This is my base.js

import pathOr from 'ramda/src/pathOr';

export default function base (request) {
    return new Promise((resolve, reject) => {
        request
            .end((err, res) => {
                if (err) {
                    return reject(pathOr({}, ['response', 'body'], err));
                }

                resolve(res.body || res.text);
            });
    });
}

How to change base.js so that all call to request (put/get/post etc.) will have the host appended with yoyo.com, in this case the put will be to yoyo.com/api/client/workspace/${id}/leave rather than /api/client/workspace/${id}/leave?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!