(refresh) refresh when requesti…

This commit is contained in:
Julien Calixte
2021-05-02 17:21:24 +02:00
parent e88584e24d
commit 7a5275dd2e
3 changed files with 6 additions and 12 deletions

View File

@@ -40,14 +40,9 @@ export const refreshToken = async () => {
if (new Date(accessToken.expirationDate) >= new Date()) {
const authenticationServerURL = new URL(AUTHENTICATION_SERVER)
authenticationServerURL.searchParams.set('type', 'refresh')
authenticationServerURL.searchParams.set('code', accessToken.refreshToken)
const response = await fetch(authenticationServerURL.toString(), {
method: 'POST',
body: JSON.stringify({
refresh_token: accessToken.refreshToken,
grant_type: 'refresh_token'
})
})
const response = await fetch(authenticationServerURL.toString())
const githubToken = (await response.json()) as
| GithubToken
| GithubTokenError