diff --git a/src/pages/ConciergePage.js b/src/pages/ConciergePage.tsx similarity index 64% rename from src/pages/ConciergePage.js rename to src/pages/ConciergePage.tsx index 841ce524b2cb..514dd0921dfc 100644 --- a/src/pages/ConciergePage.js +++ b/src/pages/ConciergePage.tsx @@ -1,36 +1,32 @@ import {useFocusEffect} from '@react-navigation/native'; -import PropTypes from 'prop-types'; +import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; +import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; -import _ from 'underscore'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import Navigation from '@libs/Navigation/Navigation'; +import type {AuthScreensParamList} from '@libs/Navigation/types'; import * as Report from '@userActions/Report'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; +import type SCREENS from '@src/SCREENS'; +import type {Session} from '@src/types/onyx'; -const propTypes = { +type ConciergePageOnyxProps = { /** Session info for the currently logged in user. */ - session: PropTypes.shape({ - /** Currently logged in user authToken */ - authToken: PropTypes.string, - }), + session: OnyxEntry; }; -const defaultProps = { - session: { - authToken: null, - }, -}; +type ConciergePageProps = ConciergePageOnyxProps & StackScreenProps; /* * This is a "utility page", that does this: * - If the user is authenticated, find their concierge chat and re-route to it * - Else re-route to the login page */ -function ConciergePage(props) { +function ConciergePage({session}: ConciergePageProps) { useFocusEffect(() => { - if (_.has(props.session, 'authToken')) { + if (session && 'authToken' in session) { // Pop the concierge loading page before opening the concierge report. Navigation.isNavigationReady().then(() => { Navigation.goBack(ROUTES.HOME); @@ -44,11 +40,9 @@ function ConciergePage(props) { return ; } -ConciergePage.propTypes = propTypes; -ConciergePage.defaultProps = defaultProps; ConciergePage.displayName = 'ConciergePage'; -export default withOnyx({ +export default withOnyx({ session: { key: ONYXKEYS.SESSION, },