Skip to content

Commit

Permalink
fix: set credentials to storage only if they are valid (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
butikden committed Jan 28, 2022
1 parent 999afc4 commit 1976963
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/factories/request.js
Expand Up @@ -65,14 +65,15 @@ class RequestFactory {

promise
.then(({ access_token, refresh_token, expires }) => {
const credentials = {
client_id: config.client_id,
access_token,
expires,
...(refresh_token && { refresh_token })
if (access_token || refresh_token) {
const credentials = {
client_id: config.client_id,
access_token,
expires,
...(refresh_token && { refresh_token })
}
storage.set('moltinCredentials', JSON.stringify(credentials))
}

storage.set('moltinCredentials', JSON.stringify(credentials))
})
.catch(() => {})

Expand Down

0 comments on commit 1976963

Please sign in to comment.