Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

currency converter api was not working sir.... #105

Open
ShekhFaisal26 opened this issue Sep 15, 2024 · 3 comments
Open

currency converter api was not working sir.... #105

ShekhFaisal26 opened this issue Sep 15, 2024 · 3 comments

Comments

@ShekhFaisal26
Copy link

brother please help.. i am new to programing. just making currency converter. you have migrated the files to github. I want to use this link https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies/eur/jpy.json in my code but i can't. so as per the given instructions i figured out a little bit and i was able to make this link https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/inr.json but at the last of this link i need usd/inr.json Plz help me out

@kaifmohamad5543
Copy link

bro do u have another api for currency converter

@fawazahmed0
Copy link
Owner

please read the migration

@kaustubh-tripathi-1
Copy link

kaustubh-tripathi-1 commented Oct 29, 2024

brother please help.. i am new to programing. just making currency converter. you have migrated the files to github. I want to use this link https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies/eur/jpy.json in my code but i can't. so as per the given instructions i figured out a little bit and i was able to make this link https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/inr.json but at the last of this link i need usd/inr.json Plz help me out

Try this brother, it's working

const baseURL = `https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies`;

const URL = `${baseURL}/${fromCurrency}.json`;

// Use it in async func. obviously
try {
        let response = await fetch(URL);

        let responseJSON = await response.json();

        let rate = responseJSON[fromCurrency][toCurrency];

        if (!response.ok) {
            throw new Error(`Network response was not ok`);
        }
    } catch (error) {
        msg.innerHTML = `Failed to fetch exchange rate. Try again later.`;
        console.error("Fetch error:", error);
        return;
    }
    
    ```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants