fix: update formatting

This commit is contained in:
Jesse Egbosionu
2024-02-15 20:33:26 +01:00
parent 47a99fb88b
commit 6fc02743fe
3 changed files with 25 additions and 8 deletions
+5 -4
View File
@@ -41,8 +41,9 @@ export default async (req, res) => {
const tap_call = fetch("https://api.taptapsend.com/api/fxRates", requestOptions)
.then((response) => response.json())
.then((result) => {
const fxRate = result.availableCountries[1].corridors.find((corridors) => corridors.countryDisplayName == "Nigeria")
return {
"rate": result.availableCountries[1].corridors[29]["fxRate"],
"rate": fxRate["fxRate"],
"provider": "TapTap", "bestRate": false, "href": "https://www.taptapsend.com/"
}
})
@@ -71,7 +72,7 @@ export default async (req, res) => {
const send_call = fetch("https://sendgateway.myflutterwave.com/api/v1/config/getcurrencyrate?fromCurrency=EUR&toCurrency=NGN", requestOptions)
.then(response => response.json())
.then(response => {
return { "rate": response.data[0].baseRate, "provider": "Send", "bestRate": false, "href": "https://send.flutterwave.com/" }
return { "rate": parseFloat(response.data[0].baseRate).toFixed(2), "provider": "Send", "bestRate": false, "href": "https://send.flutterwave.com/" }
})
.catch(error => console.log('error', error));
@@ -103,14 +104,14 @@ export default async (req, res) => {
try {
const parsed_rate = JSON.parse(stdout)
console.log("parsed_rate>>>", parsed_rate);
resolve({ "rate": parsed_rate.data.exchange_rate, "provider": "Ace Transfer", "bestRate": false });
resolve({ "rate": parseFloat(parsed_rate.data.exchange_rate).toFixed(2), "provider": "Ace Transfer", "bestRate": false });
} catch (parseError) {
console.log("parseError>>>", parseError);
reject(parseError.message);
}
});
}).then((result) => {
return { "rate": result.rate, "provider": "Ace Transfer", "bestRate": false, "href": "https://acemoneytransfer.com/referral-link/3056004" }
return { "rate": parseFloat(result.rate).toFixed(2), "provider": "Ace Transfer", "bestRate": false, "href": "https://acemoneytransfer.com/referral-link/3056004" }
}
).catch((result) => {
console.log("result>>>", result);
+2 -2
View File
@@ -48,10 +48,10 @@ export default function Rates() {
{loading ? (
<div><p>Loading...</p></div>
) : data && (
<div>
<div className='currency__container'>
{data.map(item => (
<p key={item.provider} className={item.bestRate ? 'best-rate' : ''}>
<a href={item.href}>{item.provider}: </a>{formatCurrency(item.rate)}
<a href={item.href}>{item.provider}:</a><span className='rate'>{formatCurrency(item.rate)}</span>
</p>
))}
</div>
+18 -2
View File
@@ -78,7 +78,7 @@ a {
display: flex;
justify-content: space-between;
flex-direction: column-reverse;
padding: 30px 0;
padding: 20px 0;
&__aside {
text-align: center;
@@ -110,11 +110,27 @@ a {
.best-rate {
border-radius: 3px;
display: inline-block;
padding: 2px 4px;
color: #000;
background-color: #a2f6a7;
}
.currency__container {
& a {
text-decoration: underline;
text-decoration-color: rgb(0, 119, 255);
}
& p {
margin: 2px 0;
padding: 2px 0px;
padding-right: 2px;
}
& span {
margin-left: 5px;
}
}
.footer {
width: 100%;
position: absolute;