Skip to content

Commit

Permalink
fix localStorage cache expiry bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jprusik committed Mar 31, 2023
1 parent f3f4f8d commit f1f2ecc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/utils/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ export async function get ({
break;
case 'rate_limited':
/*
@TODO let the user know how long they need to wait. May need to
reach our to the API maintainers; see:
@TODO let the user know how long they need to wait with
`x-ratelimit-reset`. May need to reach our to the API maintainers;
see:
https://stackoverflow.com/questions/70729764/api-hosts-rate-limit-header-not-read-properly#comment125042213_70729764 :
"The server needs to send the `Access-Control-Expose-Headers:
Expand Down Expand Up @@ -100,8 +101,8 @@ function setRequestCache(response: Response): void {
// do not cache JSON response if there was a service error
if (response.ok && responseJSON.data) {
localStorage.setItem(requestPath, JSON.stringify({
datetime: Date.now(),
...responseJSON
...responseJSON,
datetime: Date.now()
}));
}
});
Expand Down

0 comments on commit f1f2ecc

Please sign in to comment.