do fetch newest balance after post data on dibursement and topup request
This commit is contained in:
@ -34,25 +34,21 @@ const TransactionTopup = () => {
|
||||
const API_URL = apiConfig.transaction;
|
||||
const API_URL_WALLET = apiConfig.service_wallet;
|
||||
|
||||
useEffect(() => {
|
||||
const fetchWallets = async () => {
|
||||
try {
|
||||
const response = await GetData(
|
||||
`${API_URL_WALLET}/dashboard/balance/account/${parsedUser.customer.id}`,
|
||||
{}
|
||||
);
|
||||
if (response?.status === true) {
|
||||
setWallets(response.data || []);
|
||||
} else {
|
||||
toast.warning(response?.message || 'Failed to fetch wallet data');
|
||||
}
|
||||
} catch (error) {
|
||||
toast.warning('Failed to fetch wallet data');
|
||||
const fetchWallets = async () => {
|
||||
try {
|
||||
const response = await GetData(
|
||||
`${API_URL_WALLET}/dashboard/balance/account/${parsedUser.customer.id}`,
|
||||
{}
|
||||
);
|
||||
if (response?.status === true) {
|
||||
setWallets(response.data || []);
|
||||
} else {
|
||||
toast.warning(response?.message || 'Failed to fetch wallet data');
|
||||
}
|
||||
};
|
||||
|
||||
fetchWallets();
|
||||
}, []);
|
||||
} catch (error) {
|
||||
toast.warning('Failed to fetch wallet data');
|
||||
}
|
||||
};
|
||||
|
||||
const doPostData = async (form: typeof initialState) => {
|
||||
setIsSubmitting(true);
|
||||
@ -75,6 +71,7 @@ const TransactionTopup = () => {
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
setShowConfirmation(false);
|
||||
fetchWallets();
|
||||
ResetForm();
|
||||
}
|
||||
};
|
||||
@ -103,6 +100,10 @@ const TransactionTopup = () => {
|
||||
setAlert({ show: false, message: '' });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchWallets();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Helmet>
|
||||
|
||||
Reference in New Issue
Block a user