From e4754880ad1f2cc9f24d471c30899da965ec7c24 Mon Sep 17 00:00:00 2001 From: c3024 Date: Tue, 8 Oct 2024 14:30:39 +0530 Subject: [PATCH] migrate to useOnyx --- .../ConnectToXeroFlow/index.native.tsx | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/components/ConnectToXeroFlow/index.native.tsx b/src/components/ConnectToXeroFlow/index.native.tsx index 5bffa97b55de..ab9fa3054261 100644 --- a/src/components/ConnectToXeroFlow/index.native.tsx +++ b/src/components/ConnectToXeroFlow/index.native.tsx @@ -1,6 +1,5 @@ import React, {useEffect, useRef, useState} from 'react'; -import type {OnyxEntry} from 'react-native-onyx'; -import {useOnyx, withOnyx} from 'react-native-onyx'; +import {useOnyx} from 'react-native-onyx'; import {WebView} from 'react-native-webview'; import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; @@ -14,19 +13,13 @@ import Navigation from '@libs/Navigation/Navigation'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import type {Session} from '@src/types/onyx'; import type {ConnectToXeroFlowProps} from './types'; -type ConnectToXeroFlowOnyxProps = { - /** Session info for the currently logged in user. */ - session: OnyxEntry; -}; - -function ConnectToXeroFlow({policyID, session}: ConnectToXeroFlowProps & ConnectToXeroFlowOnyxProps) { +function ConnectToXeroFlow({policyID}: ConnectToXeroFlowProps) { const {translate} = useLocalize(); const webViewRef = useRef(null); const [isWebViewOpen, setWebViewOpen] = useState(false); - + const [session] = useOnyx(ONYXKEYS.SESSION); const authToken = session?.authToken ?? null; const [account] = useOnyx(ONYXKEYS.ACCOUNT); @@ -90,8 +83,4 @@ function ConnectToXeroFlow({policyID, session}: ConnectToXeroFlowProps & Connect ConnectToXeroFlow.displayName = 'ConnectToXeroFlow'; -export default withOnyx({ - session: { - key: ONYXKEYS.SESSION, - }, -})(ConnectToXeroFlow); +export default ConnectToXeroFlow;