Repository navigation
fix: show not found page on change owner page for invalid account #68935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
322ed4e
b90ab99
5e94cd2
845217d
23d2a41
4bc513d
8c494c5
8afd24e
71bf2ca
de03d8f
1c685ae
c69a36d
6a80b17
145b2cc
a046f1d
25c283b
497a246
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ import {View} from 'react-native'; | |
| import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; | ||
| import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
| import ScreenWrapper from '@components/ScreenWrapper'; | ||
| import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useOnyx from '@hooks/useOnyx'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
|
|
@@ -14,7 +15,7 @@ import CardAuthenticationModal from '@pages/settings/Subscription/CardAuthentica | |
| import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; | ||
| import withPolicy from '@pages/workspace/withPolicy'; | ||
| import type {WithPolicyOnyxProps} from '@pages/workspace/withPolicy'; | ||
| import {clearWorkspaceOwnerChangeFlow} from '@userActions/Policy/Member'; | ||
| import {clearWorkspaceOwnerChangeFlow, requestWorkspaceOwnerChange} from '@userActions/Policy/Member'; | ||
| import CONST from '@src/CONST'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import ROUTES from '@src/ROUTES'; | ||
|
|
@@ -33,9 +34,18 @@ function WorkspaceOwnerChangeWrapperPage({route, policy}: WorkspaceOwnerChangeWr | |
| const accountID = Number(route.params.accountID); | ||
| const error = route.params.error; | ||
| const backTo = route.params.backTo; | ||
| const currentUserPersonalDetails = useCurrentUserPersonalDetails(); | ||
| const isAuthRequired = privateStripeCustomerID?.status === CONST.STRIPE_SCA_AUTH_STATUSES.CARD_AUTHENTICATION_REQUIRED; | ||
| const shouldShowPaymentCardForm = error === CONST.POLICY.OWNERSHIP_ERRORS.NO_BILLING_CARD || isAuthRequired; | ||
|
|
||
| useEffect(() => { | ||
| if (policy?.isChangeOwnerFailed || policy?.isChangeOwnerSuccessful) { | ||
| return; | ||
| } | ||
| requestWorkspaceOwnerChange(policyID, currentUserPersonalDetails.accountID, currentUserPersonalDetails.login ?? ''); | ||
| // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @daledah Can you please give a reason why we use only policyID as dependency here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This effect is meant to call |
||
| }, [policyID]); | ||
|
|
||
| useEffect(() => { | ||
| if (!policy || policy?.isLoading) { | ||
| return; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.