@coko/server
Version:
Reusable server for use by Coko's projects
22 lines • 784 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = __importDefault(require("axios"));
const clone_1 = __importDefault(require("lodash/clone"));
const makeCall = async (callParameters, token) => {
const axiosParams = (0, clone_1.default)(callParameters);
const { headers } = axiosParams;
if (!headers) {
axiosParams.headers = {
authorization: `Bearer ${token}`,
};
}
else {
axiosParams.headers.authorization = `Bearer ${token}`;
}
return (0, axios_1.default)(axiosParams);
};
exports.default = makeCall;
//# sourceMappingURL=makeCall.js.map