const withdraw = async (savingsAccountId, destinationAccountId, amount) => {
const response = await fetch(
'https://teste-94u93qnn.uc.gateway.dev/api/v2/savings/withdrawal',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
source: {
savingsAccountId: savingsAccountId
},
destination: {
savingsAccountId: savingsAccountId,
externalAccountId: destinationAccountId
},
amount: amount,
comment: 'User withdrawal'
})
}
);
return await response.json();
};