mirror of
https://github.com/CompeyDev/fxtwitter-docker.git
synced 2025-04-09 20:40:53 +01:00
Object.keys safety for missing data
This commit is contained in:
parent
05e106b295
commit
aba1cbbf5e
1 changed files with 2 additions and 2 deletions
|
@ -300,7 +300,7 @@ export const fetchConversation = async (
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
console.log('invalid graphql tweet');
|
console.log('invalid graphql tweet');
|
||||||
if (!tweet && typeof conversation.data?.tweetResult === 'object' && Object.keys(conversation.data?.tweetResult).length === 0) {
|
if (!tweet && typeof conversation.data?.tweetResult === 'object' && Object.keys(conversation.data?.tweetResult || {}).length === 0) {
|
||||||
console.log('tweet was not found');
|
console.log('tweet was not found');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -350,7 +350,7 @@ export const fetchUser = async (
|
||||||
(_res: unknown) => {
|
(_res: unknown) => {
|
||||||
const response = _res as GraphQLUserResponse;
|
const response = _res as GraphQLUserResponse;
|
||||||
// If _res.data is an empty object, we have no user
|
// If _res.data is an empty object, we have no user
|
||||||
if (!Object.keys(response?.data).length) {
|
if (!Object.keys(response?.data || {}).length) {
|
||||||
console.log(`response.data is empty, can't continue`);
|
console.log(`response.data is empty, can't continue`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue