migros-api-wrapper
Version:
Making the api of migros more accessible to the public.
31 lines • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCumulusSession = void 0;
/* eslint-disable @typescript-eslint/naming-convention */
const requests_1 = require("../../utils/requests");
const apiPaths_1 = require("../apiPaths");
const retrieveSetCookieFromHeaders_1 = require("../../utils/retrieveSetCookieFromHeaders");
const url = apiPaths_1.migrosApiPaths["cumulus"] + "/de.html";
async function getCumulusSessionRequest(url, cookies) {
const headers = {
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.5",
"Upgrade-Insecure-Requests": "1",
"Sec-Fetch-Dest": "document",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-User": "?1",
Pragma: "no-cache",
"Cache-Control": "no-cache",
"Access-Control-Allow-Credentials": "true",
};
const response = await (0, requests_1.getRequest)(url, {}, headers, cookies);
return {
["set-cookie"]: (0, retrieveSetCookieFromHeaders_1.retrieveSetCookieFromHeaders)(response.headers),
};
}
async function getCumulusSession(cookies) {
return getCumulusSessionRequest(url, cookies);
}
exports.getCumulusSession = getCumulusSession;
//# sourceMappingURL=session.js.map