From 3522e135f4583ed5fc45275598c852d0602550ef Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Fri, 24 Feb 2023 15:19:18 +0800 Subject: [PATCH] Refresh state after connected --- packages/web/pages/settings/integrations.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/web/pages/settings/integrations.tsx b/packages/web/pages/settings/integrations.tsx index 861afe407..12ae73333 100644 --- a/packages/web/pages/settings/integrations.tsx +++ b/packages/web/pages/settings/integrations.tsx @@ -71,9 +71,9 @@ export default function Integrations(): JSX.Element { const readwiseConnected = useMemo(() => { return integrations.find((i) => i.name == 'READWISE' && i.type == 'EXPORT') }, [integrations]) - const isConnected = (name: string, type: string) => { - return integrations.find((i) => i.name === name && i.type === type) - } + const pocketConnected = useMemo(() => { + return integrations.find((i) => i.name == 'POCKET' && i.type == 'IMPORT') + }, [integrations]) const deleteIntegration = async (id: string) => { try { @@ -120,6 +120,7 @@ export default function Integrations(): JSX.Element { }) if (result) { showSuccessToast('Connected with Pocket.') + await router.push('/settings/integrations') } else { showErrorToast('There was an error connecting to Pocket.') } @@ -134,7 +135,6 @@ export default function Integrations(): JSX.Element { }, [router]) useEffect(() => { - const pocketConnected = isConnected('POCKET', 'IMPORT') setIntegrationsArray([ { icon: '/static/icons/logseq.svg',