Skip to content

Commit 91b6b2a

Browse files
committed
feat: replace UNDEFINED with void 0
1 parent 26bb049 commit 91b6b2a

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/pages/index/twitter.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { ref, shallowRef } from 'vue'
33
import { useEnhancer } from '/@/app/enhancer'
44
import { VALUABLE_LINKS } from '/@/config/app.config'
5+
import { UNDEFINED } from '/@/constants/value'
56
import { GAEventCategories } from '/@/constants/gtag'
67
import SwiperClass, { Swiper, SwiperSlide } from '/@/effects/swiper'
78
import { unescape, padStart, numberSplit } from '/@/transforms/text'
@@ -36,7 +37,7 @@
3637

3738
<template>
3839
<div class="twitter">
39-
<placeholder :data="profile ?? void 0" :loading="fetching">
40+
<placeholder :data="profile ?? UNDEFINED" :loading="fetching">
4041
<template #placeholder>
4142
<empty class="twitter-empty" bold key="empty" />
4243
</template>

src/server/getters/twitter/sotwe-api.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import axios, { isAxiosError } from '@/server/services/axios'
22
import { WEB_SCRAPER_TOKEN } from '@/config/bff.yargs'
3+
import { UNDEFINED } from '/@/constants/value'
34
import { isNodeDev } from '@/server/environment'
45
import type { TwitterTweet, TwitterProfile, TwitterAggregate } from './index'
56

@@ -129,11 +130,11 @@ export const getSotweTwitterAggregate = async (twitterUsername: string): Promise
129130
id: sotwe?.info?.id,
130131
name: sotwe?.info?.name || twitterUsername,
131132
avatar: sotwe?.info?.profileImageOriginal || '',
132-
description: sotwe?.info.description || void 0,
133-
location: sotwe?.info.location || void 0,
134-
tweetCount: sotwe?.info.postCount ?? void 0,
135-
followerCount: sotwe?.info.followerCount ?? void 0,
136-
followingCount: sotwe?.info.followingCount ?? void 0
133+
description: sotwe?.info.description || UNDEFINED,
134+
location: sotwe?.info.location || UNDEFINED,
135+
tweetCount: sotwe?.info.postCount ?? UNDEFINED,
136+
followerCount: sotwe?.info.followerCount ?? UNDEFINED,
137+
followingCount: sotwe?.info.followingCount ?? UNDEFINED
137138
}
138139

139140
// sotwe all tweets
@@ -167,9 +168,9 @@ export const getSotweTwitterAggregate = async (twitterUsername: string): Promise
167168
text: improveSotweTweet(tweet),
168169
html: improveSotweTweet(tweet),
169170
date: tweet.createdAt,
170-
location: tweet.location?.name || void 0,
171-
favoriteCount: tweet.favoriteCount ?? void 0,
172-
retweetCount: tweet.retweetCount ?? void 0,
171+
location: tweet.location?.name || UNDEFINED,
172+
favoriteCount: tweet.favoriteCount ?? UNDEFINED,
173+
retweetCount: tweet.retweetCount ?? UNDEFINED,
173174
mediaCount: tweet.mediaEntities?.length ?? 0,
174175
isReply: !!tweet.inReplyToUserId,
175176
isQuote: !!tweet.quotedStatus,

0 commit comments

Comments
 (0)