Skip to content

Commit

Permalink
fix(route/twitter): await when get cache (#17429)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnosnay authored Nov 3, 2024
1 parent 0c506b8 commit fd5a888
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/routes/twitter/api/web-api/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import login from './login';
let authTokenIndex = 0;

const token2Cookie = async (token) => {
if (cache.get(`twitter:cookie:${token}`)) {
return cache.get(`twitter:cookie:${token}`);
const c = await cache.get(`twitter:cookie:${token}`);
if (c) {
return c;
}
const jar = new CookieJar();
jar.setCookieSync(`auth_token=${token}`, 'https://x.com');
Expand Down

0 comments on commit fd5a888

Please sign in to comment.