mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
feat: implement auto entries rates re-calculation after change the exchange rate
This commit is contained in:
@@ -6,7 +6,9 @@ function getRandomItemFromArray(arr) {
|
||||
const randomIndex = Math.floor(Math.random() * arr.length);
|
||||
return arr[randomIndex];
|
||||
}
|
||||
|
||||
function delay(t, val) {
|
||||
return new Promise((resolve) => setTimeout(resolve, t, val));
|
||||
}
|
||||
/**
|
||||
* Retrieves tax rates.
|
||||
* @param {number} customerId - Customer id.
|
||||
@@ -18,12 +20,15 @@ export function useExchangeRate(
|
||||
) {
|
||||
return useQuery(
|
||||
[QUERY_TYPES.EXCHANGE_RATE, fromCurrency, toCurrency],
|
||||
() =>
|
||||
Promise.resolve({
|
||||
async () => {
|
||||
await delay(100);
|
||||
|
||||
return {
|
||||
from_currency: fromCurrency,
|
||||
to_currency: toCurrency,
|
||||
exchange_rate: getRandomItemFromArray([4.231, 2.231]),
|
||||
}),
|
||||
exchange_rate: 1.00,
|
||||
};
|
||||
},
|
||||
props,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user