-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
10,328 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// copied from https://github.com/digital-land/digital-land.info/blob/main/assets/javascripts/osApiToken.js | ||
|
||
/* const OS_API_TOKEN_URL = 'https://planning.data.gov.uk/os/getToken' // @todo - check with infrastructure team if this is okay to use | ||
const apiToken = { | ||
access_token: 'm8BKTTRw1tx7TWTwnSwINbc1A2Jt', | ||
expires_in: 0, | ||
issued_at: 0 | ||
} | ||
const makingRequest = false */ | ||
|
||
export const getApiToken = () => { | ||
/* const tokenCheckBuffer = 30 * 1000 | ||
const tokenExpires = parseInt(apiToken.expires_in) * 1000 + parseInt(apiToken.issued_at) | ||
if (Date.now() > tokenExpires - tokenCheckBuffer && !makingRequest) { | ||
getFreshApiToken() | ||
} */ | ||
return '8JG2GhYKU62nSXGfjjXc34DOvhWR' | ||
} | ||
|
||
/* export const getFreshApiToken = () => { | ||
return new Promise((resolve, reject) => { | ||
makingRequest = true | ||
fetch(OS_API_TOKEN_URL) | ||
.then(res => res.json()) | ||
.then(res => { | ||
apiToken = res | ||
makingRequest = false | ||
resolve(apiToken.access_token) | ||
} | ||
) | ||
resolve('m8BKTTRw1tx7TWTwnSwINbc1A2Jt') | ||
}) | ||
} | ||
*/ |
Oops, something went wrong.