Skip to content

Commit

Permalink
fix: 🐛 Fixes configuration fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorlarsson committed Sep 9, 2021
1 parent ab62ab6 commit 7bf8f1c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"x-xsrf-token": "SfONpuvKXD1XHML3Kelvm3easB6Xn3xtbVPG52jdpc3Q7sRxJv7_6wfjo1qS3NOQWkfCvfPkJpJg0QIBmo358o7FdQY2aWvUOxA9MU2Fl0E1",
"y-xsrf-token11": "FyXUbtZUE2iT09J7FOLTpfZ_onjbj3WEIO6jOY9B1KaZzMrAs4WS03AuWbQhmKyCEX2inTPVDzyPc58tN2EM4L1vYD6aH_zhlc7gVo9jaPdLKQc4qnE6ue184cSamKE0",
"topology-key": "mettle ohmmeter alible camper stultify sap sunbeam pussy tithable colorant scleroma trireme niggard heather wacke abide rustic armature selfheal gyrus|",
"topology-short-key": "nancyzymosiszygosis"
"topology-short-key": "nancyzymosiszygosis",
},
"referrer": "https://etjanst.stockholm.se/",
"referrerPolicy": "strict-origin-when-cross-origin",
Expand Down
15 changes: 12 additions & 3 deletions lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,13 @@ export class Api extends EventEmitter {
return authBody
}

private async getConfig(): Promise<Record<string, any>> {
const response = await this.fetch('createItemConfig', routes.createItemConfig)

const json = await response.json()
return json
}

private async retrieveCreateItemHeaders() {
const response = await this.fetch(
'createItemConfig',
Expand Down Expand Up @@ -309,13 +316,15 @@ export class Api extends EventEmitter {
return parse.user(data)
}

private getTopology(): string {
private async getTopology (): Promise<string> {

const config = await this.getConfig()

const currentTime = new Date().getTime() + 600000

let topo = `${this.getHeader('topology-key')}${currentTime}`
let topo = `${config.headers['topology-key']}${currentTime}`

const secretNumberString = this.getHeader('topology-short-key')
const secretNumberString = `${config.headers['topology-short-key']}`
const numberOfBase64Iterations = 9

for (let i = 0; i < numberOfBase64Iterations; i += 1) {
Expand Down

0 comments on commit 7bf8f1c

Please sign in to comment.