Skip to content

Commit

Permalink
migrate to useOnyx
Browse files Browse the repository at this point in the history
  • Loading branch information
c3024 committed Oct 8, 2024
1 parent 6d0ecd5 commit e475488
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions src/components/ConnectToXeroFlow/index.native.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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<Session>;
};

function ConnectToXeroFlow({policyID, session}: ConnectToXeroFlowProps & ConnectToXeroFlowOnyxProps) {
function ConnectToXeroFlow({policyID}: ConnectToXeroFlowProps) {
const {translate} = useLocalize();
const webViewRef = useRef<WebView>(null);
const [isWebViewOpen, setWebViewOpen] = useState(false);

const [session] = useOnyx(ONYXKEYS.SESSION);
const authToken = session?.authToken ?? null;

const [account] = useOnyx(ONYXKEYS.ACCOUNT);
Expand Down Expand Up @@ -90,8 +83,4 @@ function ConnectToXeroFlow({policyID, session}: ConnectToXeroFlowProps & Connect

ConnectToXeroFlow.displayName = 'ConnectToXeroFlow';

export default withOnyx<ConnectToXeroFlowProps & ConnectToXeroFlowOnyxProps, ConnectToXeroFlowOnyxProps>({
session: {
key: ONYXKEYS.SESSION,
},
})(ConnectToXeroFlow);
export default ConnectToXeroFlow;

0 comments on commit e475488

Please sign in to comment.