From 345aed8900ef4580a3d84539d0a4790b321e47c8 Mon Sep 17 00:00:00 2001 From: zuies Date: Mon, 2 Oct 2023 23:42:05 +0300 Subject: [PATCH] add inprogress field to twitter connected account for status --- src/components/pages/settings/ConnectCommunities.tsx | 1 - src/components/pages/settings/ConnectedTwitter.tsx | 8 +++++++- src/pages/settings.tsx | 1 + src/store/slices/settingSlice.ts | 7 ++----- src/store/types/ISetting.ts | 1 + src/utils/types.ts | 1 + 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/components/pages/settings/ConnectCommunities.tsx b/src/components/pages/settings/ConnectCommunities.tsx index d227c279..19a3f4b3 100644 --- a/src/components/pages/settings/ConnectCommunities.tsx +++ b/src/components/pages/settings/ConnectCommunities.tsx @@ -135,7 +135,6 @@ export default function ConnectCommunities() { user && user.twitter && Object.values(user.twitter).every((value) => value == null); - console.log({ isAllTwitterPropertiesNull }); return ( <> diff --git a/src/components/pages/settings/ConnectedTwitter.tsx b/src/components/pages/settings/ConnectedTwitter.tsx index 2ade3bc9..e6968be7 100644 --- a/src/components/pages/settings/ConnectedTwitter.tsx +++ b/src/components/pages/settings/ConnectedTwitter.tsx @@ -5,6 +5,7 @@ import useAppStore from '../../../store/useStore'; import { BsTwitter } from 'react-icons/bs'; import moment from 'moment'; import { StorageService } from '../../../services/StorageService'; +import clsx from 'clsx'; interface IConnectedTwitter { twitter?: ITwitter; @@ -37,7 +38,12 @@ function ConnectedTwitter({ twitter }: IConnectedTwitter) {

Twitter

- +
diff --git a/src/pages/settings.tsx b/src/pages/settings.tsx index 86d5d0cf..33b38f62 100644 --- a/src/pages/settings.tsx +++ b/src/pages/settings.tsx @@ -48,6 +48,7 @@ function Settings(): JSX.Element { fetchEmail(); const intervalId = setInterval(() => { getGuilds(); + getUserInfo(); }, 5000); // Clean up the interval when the component unmounts diff --git a/src/store/slices/settingSlice.ts b/src/store/slices/settingSlice.ts index e60fc206..175ede5d 100644 --- a/src/store/slices/settingSlice.ts +++ b/src/store/slices/settingSlice.ts @@ -25,13 +25,10 @@ const createSettingSlice: StateCreator = (set, get) => ({ }, getUserInfo: async () => { try { - set(() => ({ isLoading: true })); const { data } = await axiosInstance.get('/users/@me'); - set({ userInfo: data, isLoading: false }); + set({ userInfo: data }); return data; - } catch (error) { - set(() => ({ isLoading: false })); - } + } catch (error) {} }, getGuildInfoByDiscord: async (guildId) => { try { diff --git a/src/store/types/ISetting.ts b/src/store/types/ISetting.ts index ba1ea9a5..5de57107 100644 --- a/src/store/types/ISetting.ts +++ b/src/store/types/ISetting.ts @@ -20,6 +20,7 @@ export interface IUserInfo { twitterId: string; twitterProfileImageUrl: string; twitterUsername: string; + twitterIsInProgress: boolean; id: string; } diff --git a/src/utils/types.ts b/src/utils/types.ts index ef11c01d..0acee40f 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -20,6 +20,7 @@ export interface ITwitter { twitterProfileImageUrl: string; twitterUsername: string; lastUpdatedMetrics: string; + twitterIsInProgress: boolean; } export type IUser = {