skip to Main Content

Not able to make api call using axios instance – Javascript

export class TrelloService { public instance: AxiosInstance; constructor(token: string) { this.instance = axios.create({ baseURL: `https://api.trello.com/1?key=${process.env.TRELLO_API_KEY}&token=${token}`, }); } public async getUserDetails(email: string): Promise<any> { const userDetails = await this.instance.get(`/members/${email}`); return userDetails; } public static async getUserDetails2( email: string, token: string, throwError…

VIEW QUESTION

How to get gif from get response – Javascript

Here i have my flask function that returns the image: @app.route("/getResults", methods=['GET']) def get_results(): print(request) job_key = request.args["id"] filename = '/home/pat/projets/giftmaker/webapp/public/workingDir/1/test.png' return send_file(filename, mimetype='image/png') then I have my attemp to read it: export function Download ({jobID}) { const [img, setImg]…

VIEW QUESTION

How can I render the react component once the axios request is completed, I am able to get the data but it shows null twice and then displays the data – Javascript

import "./App.css"; import axios from "axios"; import { useEffect, useState } from "react"; export default function Events() { const [data, setdata] = useState(null); useEffect(() => { axios.get("https://app.ticketmaster.com/discovery/v2/events?apikey=AZAG8m4u5gq5HgkyYk0sdE9eAG32vGPT&locale=*") .then((res) => { setdata(res.data); }) .catch((error) => { console.log("Error encountered", error); }); });…

VIEW QUESTION
Back To Top
Search