fix(route/twitter): await when get cache (#17429)

This commit is contained in:
Gnosnay
2024-11-03 22:18:10 +08:00
committed by GitHub
parent 0c506b84c8
commit fd5a888f18
+3 -2
View File
@@ -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');