fix: update formatting
This commit is contained in:
@@ -41,8 +41,9 @@ export default async (req, res) => {
|
|||||||
const tap_call = fetch("https://api.taptapsend.com/api/fxRates", requestOptions)
|
const tap_call = fetch("https://api.taptapsend.com/api/fxRates", requestOptions)
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
|
const fxRate = result.availableCountries[1].corridors.find((corridors) => corridors.countryDisplayName == "Nigeria")
|
||||||
return {
|
return {
|
||||||
"rate": result.availableCountries[1].corridors[29]["fxRate"],
|
"rate": fxRate["fxRate"],
|
||||||
"provider": "TapTap", "bestRate": false, "href": "https://www.taptapsend.com/"
|
"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)
|
const send_call = fetch("https://sendgateway.myflutterwave.com/api/v1/config/getcurrencyrate?fromCurrency=EUR&toCurrency=NGN", requestOptions)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(response => {
|
.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));
|
.catch(error => console.log('error', error));
|
||||||
|
|
||||||
@@ -103,14 +104,14 @@ export default async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
const parsed_rate = JSON.parse(stdout)
|
const parsed_rate = JSON.parse(stdout)
|
||||||
console.log("parsed_rate>>>", parsed_rate);
|
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) {
|
} catch (parseError) {
|
||||||
console.log("parseError>>>", parseError);
|
console.log("parseError>>>", parseError);
|
||||||
reject(parseError.message);
|
reject(parseError.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).then((result) => {
|
}).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) => {
|
).catch((result) => {
|
||||||
console.log("result>>>", result);
|
console.log("result>>>", result);
|
||||||
|
|||||||
+2
-2
@@ -48,10 +48,10 @@ export default function Rates() {
|
|||||||
{loading ? (
|
{loading ? (
|
||||||
<div><p>Loading...</p></div>
|
<div><p>Loading...</p></div>
|
||||||
) : data && (
|
) : data && (
|
||||||
<div>
|
<div className='currency__container'>
|
||||||
{data.map(item => (
|
{data.map(item => (
|
||||||
<p key={item.provider} className={item.bestRate ? 'best-rate' : ''}>
|
<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>
|
</p>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+18
-2
@@ -78,7 +78,7 @@ a {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
flex-direction: column-reverse;
|
flex-direction: column-reverse;
|
||||||
padding: 30px 0;
|
padding: 20px 0;
|
||||||
|
|
||||||
&__aside {
|
&__aside {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -110,11 +110,27 @@ a {
|
|||||||
.best-rate {
|
.best-rate {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 2px 4px;
|
|
||||||
color: #000;
|
color: #000;
|
||||||
background-color: #a2f6a7;
|
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 {
|
.footer {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
Reference in New Issue
Block a user