Skip to content

Commit 45c6473

Browse files
authored
Merge pull request #59 from fa0311/dev
Fix getClientFromCookies
2 parents 56448d3 + d7954a2 commit 45c6473

File tree

1 file changed

+4
-5
lines changed
  • twitter-openapi-typescript/src

1 file changed

+4
-5
lines changed

twitter-openapi-typescript/src/api.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,12 @@ export class TwitterOpenApi {
118118
}
119119

120120
async getClientFromCookies(ct0: string, authToken: string): Promise<TwitterOpenApiClient> {
121-
const cookies: TwitterOpenApiCookie[] = await this.getGuestSession();
122-
[
121+
const guestCookies: TwitterOpenApiCookie[] = await this.getGuestSession();
122+
const cookies = [
123123
{ name: 'auth_token', value: authToken },
124124
{ name: 'ct0', value: ct0 },
125-
]
126-
.filter((e) => cookies.findIndex((c) => c.name == e.name) == -1)
127-
.forEach((e) => cookies.push(e));
125+
];
126+
guestCookies.filter((e) => cookies.findIndex((c) => c.name == e.name) == -1).forEach((e) => cookies.push(e));
128127

129128
const config: i.ConfigurationParameters = {
130129
fetchApi: this.param.fetchApi || fetch,

0 commit comments

Comments
 (0)