gatsby-source-wordpress
Version:
Source data from WordPress in an efficient and scalable way.
32 lines (31 loc) • 889 B
JavaScript
;
exports.__esModule = true;
exports.setRequestHeaders = void 0;
var _stringEncoding = require("../utils/string-encoding");
var _getGatsbyApi = require("../utils/get-gatsby-api");
const setRequestHeaders = ({
actions
}) => {
if (typeof (actions === null || actions === void 0 ? void 0 : actions.setRequestHeaders) !== `function`) {
return;
}
const pluginOptions = (0, _getGatsbyApi.getPluginOptions)();
const {
auth,
url
} = pluginOptions;
const {
password,
username
} = (auth === null || auth === void 0 ? void 0 : auth.htaccess) || {};
if (password && username) {
actions.setRequestHeaders({
domain: url,
headers: {
Authorization: `Basic ${(0, _stringEncoding.b64e)(`${username}:${password}`)}`
}
});
}
};
exports.setRequestHeaders = setRequestHeaders;
//# sourceMappingURL=set-request-headers.js.map