Skip to content

Commit

Permalink
feat: 🎸 Changes the call back data on transfer (#925)
Browse files Browse the repository at this point in the history
  • Loading branch information
hvilander authored Oct 20, 2023
1 parent 98eeb6c commit 753df01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/components/SQFormTransferTool/AccordionBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ export default function AccordionBody({
const {values, ...formikHelpers} = useSQFormContext<FormContext>();

function handleTransfer() {
const {productID, transferLine} = transferProduct;
onTransfer(
{transferLine, productID, ...transformForm(values)},
{product: transferProduct, ...transformForm(values)},
formikHelpers
);
}
Expand Down
7 changes: 3 additions & 4 deletions src/components/SQFormTransferTool/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ type OnSaveCallBackData = {
};

type TransferCallBackData = OnSaveCallBackData & {
/** the id of the transferproduct for which the transfer button was clicked */
productID: TransferProduct['productID'];
/** number provided for transfer */
transferLine: string | null;
/** the product which is calling its transfer or alternative behavior */
product: TransferProduct;
};

export type CallBackData = OnSaveCallBackData | TransferCallBackData;
Expand All @@ -70,6 +68,7 @@ export type OnTransfer = (
callBackData: TransferCallBackData,
formikHelpers: FormikHelpers<FormContext>
) => void;

export type OnSave = (
callBackData: OnSaveCallBackData,
formikHelpers: FormikHelpers<FormContext>
Expand Down

0 comments on commit 753df01

Please sign in to comment.