refactor: resolve currency exchange issue
This commit is contained in:
@@ -16,10 +16,7 @@ export const CurrencyProvider = ({ children }) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchCurrencyForCountry = async () => {
|
const fetchCurrencyForCountry = async () => {
|
||||||
try {
|
try {
|
||||||
const userCountry = localStorage.getItem('userCountry');
|
let userCountry = localStorage.getItem('userCountry') || "India";
|
||||||
if (!userCountry) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await axios.get(`https://restcountries.com/v3.1/name/${userCountry}`);
|
const response = await axios.get(`https://restcountries.com/v3.1/name/${userCountry}`);
|
||||||
if (response.data && response.data.length > 0) {
|
if (response.data && response.data.length > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user