Skip to content

Commit

Permalink
fix policy
Browse files Browse the repository at this point in the history
  • Loading branch information
waterim committed Oct 15, 2024
1 parent 75b42ff commit 161e5f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
12 changes: 4 additions & 8 deletions src/pages/workspace/companyCards/addNew/AddNewCardPage.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import type {StackScreenProps} from '@react-navigation/stack';
import React from 'react';
import {useOnyx} from 'react-native-onyx';
import usePermissions from '@hooks/usePermissions';
import type {FullScreenNavigatorParamList} from '@libs/Navigation/types';
import withPolicyAndFullscreenLoading from '@pages/workspace/withPolicyAndFullscreenLoading';
import type {WithPolicyAndFullscreenLoadingProps} from '@pages/workspace/withPolicyAndFullscreenLoading';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type SCREENS from '@src/SCREENS';
import AmexCustomFeed from './AmexCustomFeed';
import CardInstructionsStep from './CardInstructionsStep';
import CardNameStep from './CardNameStep';
Expand All @@ -15,10 +13,8 @@ import DetailsStep from './DetailsStep';
import SelectBankStep from './SelectBankStep';
import SelectFeedType from './SelectFeedType';

type AddNewCardPageProps = StackScreenProps<FullScreenNavigatorParamList, typeof SCREENS.WORKSPACE.COMPANY_CARDS_ADD_NEW>;

function AddNewCardPage({route}: AddNewCardPageProps) {
const {policyID} = route.params;
function AddNewCardPage({policy}: WithPolicyAndFullscreenLoadingProps) {
const policyID = policy?.id;
const [addNewCardFeed] = useOnyx(ONYXKEYS.ADD_NEW_COMPANY_CARD);
const {canUseDirectFeeds} = usePermissions();

Expand Down Expand Up @@ -48,7 +44,7 @@ function AddNewCardPage({route}: AddNewCardPageProps) {
case CONST.COMPANY_CARDS.STEP.CARD_TYPE:
return <CardTypeStep />;
case CONST.COMPANY_CARDS.STEP.CARD_INSTRUCTIONS:
return <CardInstructionsStep policyID={policyID} />;
return <CardInstructionsStep />;
case CONST.COMPANY_CARDS.STEP.CARD_NAME:
return <CardNameStep />;
case CONST.COMPANY_CARDS.STEP.CARD_DETAILS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';

type CardInstructionsStepProps = {
policyID: string;
policyID?: string;
};
function CardInstructionsStep({policyID}: CardInstructionsStepProps) {
const {translate} = useLocalize();
Expand All @@ -39,7 +39,7 @@ function CardInstructionsStep({policyID}: CardInstructionsStepProps) {

const submit = () => {
if (canUseDirectFeeds && isStripeFeedProvider) {
Card.updateSelectedFeed(feedProvider, policyID);
Card.updateSelectedFeed(feedProvider, policyID ?? '-1');
Navigation.goBack();
return;
}
Expand Down

0 comments on commit 161e5f9

Please sign in to comment.