From 3b6759566b04936672904131635f237945f72900 Mon Sep 17 00:00:00 2001 From: Wazbat Date: Wed, 5 Jul 2023 23:27:49 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactored=20fetch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fetch.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/fetch.ts b/src/fetch.ts index a08d34e..921b143 100644 --- a/src/fetch.ts +++ b/src/fetch.ts @@ -1,6 +1,6 @@ import { Constants } from './constants'; import { generateUserAgent } from './helpers/useragent'; -import { isGraphQLTweet, isGraphQLTweetNotFoundResponse } from './utils/graphql'; +import { isGraphQLTweet } from './utils/graphql'; const API_ATTEMPTS = 16; @@ -242,10 +242,11 @@ export const fetchConversation = async ( if (tweet?.__typename === 'TweetUnavailable' && tweet.reason === 'NsfwLoggedOut') { return true; } - if (Array.isArray(conversation.errors)) { + if (tweet?.__typename === 'TweetUnavailable') { return true; } - return false; + // Final clause for checking if it's valid is if there's errors + return Array.isArray(conversation.errors) } )) as TweetResultsByRestIdResult; };