Skip to content

Commit

Permalink
2024-09-07T18-19-45
Browse files Browse the repository at this point in the history
  • Loading branch information
sspilleman committed Sep 7, 2024
1 parent b4cc9e7 commit 50be17b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions services/soundcloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ console.log({ CLIENT_ID, CLIENT_SECRET });

export const getHeaders = async () => {
let found = false;
let expired = false;
const now = new Date().getTime();
if (!found) {
const existing = await kv.get<number>(kvkeys.expires_in);
if (existing.value && existing.value < now) expired = true;
}
const expiry_date = await kv.get<number>(kvkeys.expires_in);
const expired = expiry_date.value ? expiry_date.value < now : true;
if (!expired) {
// Get existing headers
const existing = await kv.get<HeadersInit>(kvkeys.headers);
Expand Down

0 comments on commit 50be17b

Please sign in to comment.