mirror of
https://github.com/badlogic/heissepreise.git
synced 2024-06-29 20:05:51 +02:00
Generate Hofer access token
This commit is contained in:
parent
c94472eb25
commit
fe27a2a87d
|
@ -71,11 +71,10 @@ async function fetchHofer() {
|
|||
const CONFIG={headers: {authorization: null}}
|
||||
const ITEMS = BASE_URL+`/productlist/CategoryProductList`
|
||||
|
||||
// TODO: create/fetch token on the fly
|
||||
if(CONFIG.headers.authorization == null) {
|
||||
console.warn("SKIP Hofer (no token set)")
|
||||
return [];
|
||||
}
|
||||
// fetch access token
|
||||
const token_data ={"OwnWebshopProviderCode":"","SetUserSelectedShopsOnFirstSiteLoad":true,"RedirectToDashboardNeeded":false,"ShopsSelectedForRoot":"hofer","BrandProviderSelectedForRoot":null,"UserSelectedShops":[]}
|
||||
const token = (await axios.post("https://shopservice.roksh.at/session/configure", token_data, {headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }})).headers['jwt-auth'];
|
||||
CONFIG.headers.authorization = "Bearer " + token;
|
||||
|
||||
// concat all subcategories (categories.[i].ChildList)
|
||||
const categories = (await axios.post(CATEGORIES, {}, CONFIG)).data;
|
||||
|
|
Loading…
Reference in New Issue
Block a user