Skip to content

Commit

Permalink
fix: apply requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
koko57 committed Aug 13, 2024
1 parent 948d646 commit f63c718
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import {useOnyx} from 'react-native-onyx';
import Button from '@components/Button';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
Expand All @@ -19,23 +18,21 @@ import Navigation from '@navigation/Navigation';
import * as Card from '@userActions/Card';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type * as OnyxTypes from '@src/types/onyx';
import type {IssueNewCardStep} from '@src/types/onyx/Card';

type ConfirmationStepProps = {
// The policy that the card will be issued under
policy: OnyxEntry<OnyxTypes.Policy>;
// ID of the policy that the card will be issued under
policyID: string;
};

function ConfirmationStep({policy}: ConfirmationStepProps) {
function ConfirmationStep({policyID}: ConfirmationStepProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const {isOffline} = useNetwork();

const [issueNewCard] = useOnyx(ONYXKEYS.ISSUE_NEW_EXPENSIFY_CARD);

const data = issueNewCard?.data;
const policyID = policy?.id ?? '-1';

const submit = () => {
Card.issueExpensifyCard(policyID, CONST.COUNTRY.US, data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ function IssueNewCardPage({policy}: WithPolicyAndFullscreenLoadingProps) {

const {currentStep} = issueNewCard ?? {};

const policyID = policy?.id ?? '-1';

// TODO: add logic to skip Assignee step when the flow is started from the member's profile page
useEffect(() => {
Card.startIssueNewCardFlow(policy?.id ?? '-1');
}, [policy?.id]);
Card.startIssueNewCardFlow(policyID);
}, [policyID]);

switch (currentStep) {
case CONST.EXPENSIFY_CARD.STEP.ASSIGNEE:
Expand All @@ -34,7 +36,7 @@ function IssueNewCardPage({policy}: WithPolicyAndFullscreenLoadingProps) {
case CONST.EXPENSIFY_CARD.STEP.CARD_NAME:
return <CardNameStep />;
case CONST.EXPENSIFY_CARD.STEP.CONFIRMATION:
return <ConfirmationStep policy={policy} />;
return <ConfirmationStep policyID={policyID} />;
default:
return <AssigneeStep policy={policy} />;
}
Expand Down

0 comments on commit f63c718

Please sign in to comment.