Questions tagged [axios]

Axios, a JavaScript-based Promise-driven HTTP client, serves as an excellent tool for both front-end and Node.js back-end development in any application.

Sending a PDF generated with jsPDF to an API without the need for downloading it from the front end

I have been successful in generating a PDF on the front end and downloading it using the code below. However, I am now faced with the challenge of sending this generated PDF to the server via an API call using fetch or Axios. Despite my research efforts, ...

Node/Express API returning empty body when being accessed through fetch or axios requests

Currently working on integrating an API call in a React app using Node/Express. No matter where I place the fetch/axios call, the parsed body always shows up as undefined in my controller. Yesterday, I was experimenting with fetch but decided to switch to ...

The v-data-table is unable to fetch the user list information from the API using Axios

How can I solve the issue of displaying "No data available" in the user list data table on my userDirectory page? I have created a userDirectory page with a subheader and a data table from Vuetify, but it seems to have no data available. <template> ...

What is the solution for resolving the error "Uncaught TypeError: Cannot read property '_wrapper' of undefined" while utilizing webpack in conjunction with Vue?

When I am utilizing axios to fetch data from the database, I receive a server response in an array format: In my HTML tags: The JavaScript code appears as follows: data() { return { departments: { id: 0, ...

Troubleshooting CORS errors in axios requests within a Next.js application

Encountering an issue while attempting to make an axios call to my API on a different localhost. How can this be resolved? The tech stack being used includes Next.js, TypeScript, and Axios. Below is the function which - although written poorly for testing ...

Best practices for implementing JWT refresh tokens in an Express application

As I work on implementing the refresh token system, I have encountered a few questions along the way. My current setup involves using next.js with axios on the frontend and express with cookie-session on the backend. Here is my proposed approach: When a c ...

Retrieve a file from an Express API using React with the help of Axios

When working with a React client and an Express API, how can the React client download a file sent by the Express API? Issue: If I manually enter the URL into my browser's address bar and hit enter, the file downloads successfully. However, when I make ...

What is the best method to retrieve initial data in Vue 3 using async/await prior to rendering?

I am currently in the early stages of learning Vue 3 and I'm looking to fetch initial data from an API to populate certain fields before the App component is loaded. According to the [documentation][1], top-level await can be used within the <script set ...

Turning JSON data into an array format, omitting the keys

Can someone help me with a query that will retrieve a specific column from the database and return it in this format: [ { "tenantName": "H&M" }, { "tenantName": "McDonalds" } ] I would like to transform ...

There was an issue with the NextJS axios request as it returned a status code

I'm currently in the process of developing an application with NextJS and Strapi In my project, I am fetching data from Strapi using Axios within NextJS Next: 14.0.4 Axios: ^1.6.5 Strapi: 4.17.1 Node: 18.17.0 Here is the code snippet: import axios f ...

Tips for utilizing react redux to display information retrieved from an api in a dropdown menu?

Following my request for a locale API, I need to retrieve and populate the response data inside a select element. Upon checking the status of my request by logging (DATA STATE) in the console, I received the following output: DATA STATE {data: Array(27), ...

Is it possible to modify content in a Laravel post using formData?

Working on a social network, I encountered an issue when trying to enable post editing. The error message displayed is: message: "This action is unauthorized." Despite following the flow of sending data through Axios calls and defined routes to the contr ...

Update the headers of the axios.create instance that is exported by Axios

I have a single api.js file that exports an instance of axios.create() by default: import axios from 'axios' import Cookies from 'js-cookie' const api = axios.create({ baseURL: process.env.VUE_APP_API_URL, timeout: 10000, headers: { 'Content-Typ ...

Exclusive to Safari: Codesandbox is experiencing difficulties retrieving data from the localhost server

Would you mind helping me out with this technical issue I'm facing? For the server/API, I am using this link. As for the mock website, it can be found at this URL. The problem is that, in my code, I'm using axios to fetch data from the locally hosted serv ...

Retrieve a formatted Word document from a C# endpoint to a Node.js server

I am currently facing an issue with my Node.js server that sends a GET request using axios to a C# endpoint with JSON as a parameter. The C# API then uses Newtonsoft.Json to deserialize the JSON, reads a Word file into memory, and inserts data. The final s ...

Bypass SSL certification validation in Axios

Encountering an issue while calling the API. The error message "Error: unable to get local issuer certificate" is being displayed. To resolve this, I attempted to add a httpsAgent as shown below: var agent = new https.Agent({ rejectUnauthorized: false ...

What is the best way to retrieve the ID of a post request using React's axios hook?

My goal is to make a post request to create an app, and then establish its links. To achieve this, I need to obtain the id of the newly created items in order to create the links. Is there a way to retrieve the id of the item created through the post reque ...

What steps should I take to resolve an unhandled promise error in a React TypeScript application while making an axios POST request?

I am currently working on a .tsx file to implement adding an enterprise feature. Although I can input data, clicking the submit button does not trigger any action. My application includes a page that has a button for adding a new enterprise. Upon clickin ...

How come the useEffect hook is causing re-rendering on every page instead of just the desired endpoint?

I am a novice attempting to retrieve data from a database and display it on the front-end using Axios, ReactJS, and TypeScript. My intention is for the data to be rendered specifically on localhost:3000/api/v1/getAll, but currently, it is rendering on all ...

When the Express API sends back a random number, Axios and React repeatedly call the API

I am facing an issue while creating a react component that displays a random number fetched from an API. The problem is that the number keeps re-rendering infinitely and the server console shows continuous requests from react. How can I fix this? I am curr ...

VueJS refreshes components while preserving previous data

As a newcomer to VueJs, I am currently working with a Practice component that includes an ExerciseMC component. The parent component retrieves a question object (with a text property) from the backend through a request and passes it as a prop to the Exerci ...

What are some strategies for handling data after it has been retrieved using Axios?

In my current project, I am working with MySQL database and fetching data using Axios and a useEffect hook. Once the data is retrieved, I pass it to a component as a prop. Here's how: const Component = () => { //Database URL const urlProxy = "/ ...

Using v-select to connect a Rest API with v-data-table was not displaying correctly, so I had to resort to using v-for to populate the table instead

Purpose: 1.Rest API >>> by axios 2.Select category >>> by v-select 3.Show table >>> by v-data-table however, there is an issue with displaying the table so I am using v-for to show it instead. View what I have managed to displa ...

The React application encounters errors when the API URL provided is incorrect

Embarking on my first React application journey, I am faced with a challenge. A form with two input fields prompts the user to enter the name of a country and a city before submitting the form. The city and country variables are then passed to the subseque ...

Transforming the Blade user profile into a sleek Vue interface for the Laravel-Vue project

They have requested me to convert all pages from blade to vuejs. I have begun the process with the user profile (Profile.vue), but I am unsure about how to execute PUT requests using Axios in this case. Can someone provide guidance on creating the code for ...

Troubleshooting Axios Interceptor issue post page refresh in Vue.js

I've been working on a simple CRUD application using Spring, Vue.js, and H2 database. The development is almost complete, but I encountered some authentication issues. After entering all the required credentials, the login is successful, and I'm redirected ...

The Axios POST request successfully sends the data to the Express server but unfortunately encounters a 404 error

Error 404 when Sending Data from Axios POST Request to Express Server Hey there! I'm currently working on setting up a user authentication server for a project, but I've hit a roadblock while attempting to send a POST request to my Node.js Express server. ...

Error: OpenAI's transcription API has encountered a bad request issue

const FormData = require('form-data'); const data = new FormData(); console.log('buffer: ', buffer); console.log('typeof buffer: ', typeof buffer); const filename = new Date().getTime().toString() + '.webm'; data.append('model', 'whi ...

Axios and Express are throwing an error of "response is not defined

I'm facing an issue with the post method in my back-end code. Here's a simplified version of it: router.post('/users', async function(request, response) { try { const userToRegister = request.body; const user = await CreateUserService.execute(use ...

Getting an error message stating "Cannot update headers after they have been sent" while working with Node.js/Express and Axios

I encountered the following error and need assistance in finding a workaround. My goal is to output the data as a JSON object. Is there a solution to navigate around this error? I am currently copying and pasting from a tutorial, but I can't pinpoint ...

When incorporating axios within an express route, it is causing the data field to display unusual characters instead of JSON

I've been grappling with this issue for quite some time now, and any assistance would be greatly appreciated. Initially, I attempted to resolve the problem by utilizing the Moralis nodeJs library. While it worked fine on my local environment, it retu ...

Send JSON information to a Spring Boot server application

I am brand new to working with Spring Boot. Currently, I am attempting to send registration form data (in JSON format) from a Vue frontend to a Spring Boot backend. However, the backend always indicates that the received data is null. How can I properly re ...

Issue with Axios not including cookies in the headers, irrespective of the use of withCredentials: true | Backend with FastAPI

Here is my axios configuration I am able to receive the cookie successfully using Postman, so it seems to be an issue with axios. const api = axios.create({ baseURL: 'http://localhost:8000/', withCredentials: true, headers: { crossDomain: true, 'Con ...

Using the power of ReactJS, efficiently make an axios request in the

After familiarizing myself with Reactjs, I came across an interesting concept called componentDidUpdate(). This method is invoked immediately after updating occurs, but it is not called for the initial render. In one of my components, there's a method tha ...

Wait for Axios Request Interceptor to complete before sending another ajax call

One feature I have added is a request interceptor for all axios calls. This interceptor checks the JWT token and automatically refreshes it if necessary. axios.interceptors.request.use((config) =>{ const currentState = store.getState(); // get upd ...

Tips on parsing a CSV file from a Node/Express Axios GET request?

I am currently working on a Node/Express backend that utilizes axios to send a GET request to the following URL: https://marknadssok.fi.se/Publiceringsklient/sv-SE/Search/Search?SearchFunctionType=Insyn&Utgivare=&PersonILedandeSt%C3%A4llningNamn=&a ...

An app activation code 401 error suddenly appears, prompting a quick response to refresh the token in the axios interceptor feature

AxiosConfig.js import axios from "axios"; import { store } from "./redux/store"; import { login, logout } from "./redux/slices/user"; const baseURL = process.env.NEXT_PUBLIC_API_URL; axios.defaults.baseURL = baseURL; expor ...

Defer the rendering of Vue.js pages until the data request is completed

I am currently working on a page that retrieves data from the server using axios. My goal is to wait for the axios request to complete before rendering the page content. The reason behind this approach is that I already have a prerendered version of the ...

Encountering a 403 Forbidden error in Spring Boot while attempting to upload an image to the server via a POST request

Currently, I am facing an issue while trying to upload photos into the database as I keep encountering error 403. Interestingly, everything was functioning smoothly when I tested the endpoint using POSTMAN. However, upon creating the axios request, the err ...

Troubleshooting Axios Error while Sending Data in MERN Stack Application

In my development setup, I'm testing model validation specifically for the length of a name variable. The front-end is configured at http://localhost:3000/ using React + axios, while the back-end utilizes express + node. To enable communication betwe ...

Axios - Error: Promise Rejected - The request was unsuccessful with a 500 status code

The Axios post request in my code for adding new articles is not going through, and I am encountering an error: Failed to load resource: the server responded with a status of 500 (Internal Server Error) createError.js:17 Uncaught (in promise) Error: Requ ...