reddit: fix expiry check

This commit is contained in:
dumbmoron 2023-11-17 12:00:04 +00:00
parent 60743cdcdf
commit c26800ca2e
No known key found for this signature in database
GPG key ID: C59997C76C6A8E5F

View file

@ -18,7 +18,7 @@ async function getAccessToken() {
const values = cookie.values(), const values = cookie.values(),
needRefresh = !values.access_token needRefresh = !values.access_token
|| !values.expiry || !values.expiry
|| Number(values.expiry) > new Date().getTime(); || Number(values.expiry) < new Date().getTime();
if (!needRefresh) return values.access_token; if (!needRefresh) return values.access_token;
const data = await fetch('https://www.reddit.com/api/v1/access_token', { const data = await fetch('https://www.reddit.com/api/v1/access_token', {