Skip to content

Commit

Permalink
chore/#75 api 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
altys31 committed Aug 31, 2024
1 parent 624f904 commit 367852d
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions ssh-web/src/pages/Account/Child/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface DepositAccountCardProps {
handleDeleteAccountModal: (
item: ICommonAccount | ISavingAccount | IDepositAccount | null,
) => void;
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
}

interface InstallmentAccountCardProps {
Expand Down Expand Up @@ -177,6 +178,30 @@ export const Account = () => {
setSelectedAccount(account);
};

interface submitSendMoneyProps {
amount: string;
accountNumber: string;
memo: string;
}

const submitSendMoney = ({
amount,
accountNumber,
memo,
}: submitSendMoneyProps) => {
setIsOpen(false);
api
.post(`/api/accounts/transfer`, {
transactionBalance: amount,
depositAccountNo: accountNumber,
transactionSummary: memo,
})
.then((response) => {
showToast('success', '송금이 성공적으로 완료되었습니다.');
})
.catch((error: Error) => {});
};

const ReturnTypeModal = () => {
switch (modalType) {
case 'SEND':
Expand Down Expand Up @@ -224,6 +249,7 @@ export const Account = () => {
handleSendMoney={handleSendMoneyModal}
handleAccountLogModal={handleAccountLogModal}
handleDeleteAccountModal={handleDeleteAccountModal}
setIsOpen={setIsOpen}
/>
);
} else if (item?.accountType === '3') {
Expand Down Expand Up @@ -314,6 +340,7 @@ export const DepositAccountCard = ({
handleSendMoney,
handleAccountLogModal,
handleDeleteAccountModal,
setIsOpen,
}: DepositAccountCardProps) => {
return (
<div className="bg-secondary-200 p-4 rounded-lg shadow-lg w-full">
Expand Down Expand Up @@ -521,27 +548,17 @@ export const SendMoneyModal = ({ account, setIsOpen }: SendMoneyModalProps) => {
size="xl"
fullWidth={true}
variant="standard"
state={amountState}
onChange={handleAmountChange}
onChange={handlMemoChange}
/>
<div className="absolute right-0 top-3">
<Typography color="secondary" size="lg">
(원)
</Typography>
</div>
</div>
{errors.amount && (
<Typography color="danger" size="sm" classNameStyles="mt-2">
{errors.amount}
</Typography>
)}

<div className="flex justify-center">
<Button
fullWidth={true}
classNameStyles="mt-8"
disabled={!isFormValid}
onClick={() => {
setIsOpen(false);
api
.post(`/api/accounts/transfer`, {
transactionBalance: amount,
Expand Down

0 comments on commit 367852d

Please sign in to comment.