News Articles axios

React: Axios Error "Error: Network Error", My react app cannot receive axios.post response

I hava Nodejs Express Backend, React Frontend. I checked if frontend sends a request to the backend and that request is sent to backend. And the backend sends a response to the frontend but cannot receive. Frontend — request –> Backend checked. and the request reaches the backend. Frontend <– response — Backend During the […]

An undefined object created when I create an object by using axios in the React-redux project

I am struggling with a React exercise which uses Redux. When I create a new object, there is always an undefined object created. However, I can not see anything strange on db.json file or when I go to the address of JSON server. After that when I reload the page, all of the warnings disappear. […]

How to use axios auth to send get request for a downloadlink

I am sending a get request using axios and sending a auth username and password. For a downloadlink if it work opens and cloases a page then download the file. I keep getting cors policy issue when trying this Source: React – Stack Overflow

API doesn’t detecting model in PUT request in axios put

I’m using asp.net core with vuejs and axios. I’m trying to hit my put API but its not passing the object model. Rest of the functions are working fine but only put is not catching the object. please focus on function updatestokes only var app = new Vue({ el: ‘#app’, data: { newStock: { productId: […]

React – Context Data loses the response of Axios call

I am new to React so I hope someone can help me. I am creating an application that uses a Context component to pass to the rest of my components a data taken from my back-end using axios. In the first component that lists the users, the data is received correctly but when I go […]

Array Parameters in Axios

My names are Kevin and are a proud member of Stack Overflow. I have a problem regarding the string array params as per the below endpoint: Endpoint: API/resource/Customer?fields=["*"]&filters=[["mobile_no","=","0722123456"]] How do I serialize the mobile number? My request should look as follows: axios.get(‘api/resource/Customer’, { params: { fields: ["*"], filters: [["mobile_no", "=", "++"]], } }); Source: Vue […]

Axios post request is not working for a register form submission

I have a form built in react js and I am using an axios post request to register a user after form submission. I have tried to put a try catch block after the promise but i dont think i am getting passed the post request. I have imported axios and checked package json to […]

Vuejs get the value of object and pass in the api url

I have an object Team see below team{ "acf": { "acf_choose_character": [11], } }` What i want to do is to take the value of acf_choose_character and pass it to an api url www.test.gr/character/?id=acf_choose_character and fetch the character object with axios get! Source: Vue – Stack Overflow

How can i define an element in array when i use vue and vuex?

I use vuex with vue. And i have a v-for snippet in my vue file for listing my datas. it looks like <tr v-for="(element, index) in tasks" :key="index"> <td> <div> <router-link :to="{ path: ‘/task-management/’ + index }"> <p>{{element.title}}</p> </router-link> </div> </td> <td> <div> <p>{{element.status}}</p> </div> </td> blah blah … … … <tr/> its listing my […]

Is it possible to send a get request with JSON body in Axios?

Get requests with JSON body option available in postman. but, How to send a body with get request in Axios? Source: React – Stack Overflow

Even though I installed axios on my Vue project, it still returns an error

This dependency was not found: axios in ./src/components/history.js To install it, you can run: npm install –save axios I prepared the history.js file for the response. no matter how I try, no matter how many times I reload the axios, the same error occurs. Source: Vue – Stack Overflow

Storing the contents of an axios response into a variable in typescript [duplicate]

I’m relatively new to javascript and typescript in general and am struggling to understand the concept of async/await and Promises. (My knowledge is more Python based) I am trying to make sense of why this function won’t work. const getData = () => { var myData: string; axios.get(myEndPoint) .then((response) => { console.log(response.data) // this outputs […]

axios: how to access response when getting 403 exception?

I have the following scenario: The backend detects that the token has expired, so it returns 403 with custom "error" response header. This can be reproduced by firing the following request: axios.get(MY_URL) .then(res => console.log("I am expecting to enter this block, and do something with the response header")) .catch(err => console.log("But instead I skip the […]

Invalid hook call. How to set a value with react axios get call?

I have this react component that has a simple form where, when you put a superhero name, it makes an axios get request to an API that responds successfully with json object with info of said hero. That info is stored in the state and then mapped through to create a grid. It used to […]

How to fix ‘TypeError: Cannot read properties of undefined (reading ‘classType’)’ in React Native + axios?

The problem is that when I request data in JSON format from my server, axios cannot properly deserialize one field, while it correctly deserializes all other fields. Image with react error const [ unit, setUnit ] = useState(”) useEffect(() => getUnit(params.id), []) function getUnit(id) { axios.get(apiUrl + ‘/get?id=’ + id, config) .then(res => { setUnit(res,data); […]

React Native how to send AsyncStorage data to MongoDB database?

I am not able to transfer user input which is stored in a AsyncStorage to my MongoDB database I have a MongoDB database which I start from the terminal. The console output is the following so there should not be any problems: Server started on PORT 5000 MongoDB Connected cluster0-shard-00-02.mhqqx.mongodb.net After this I open my […]

django rest api permission problem with post and put

I have a problem with post and put request. My requests with axios in react: handleSubmit() { axios.post(‘http://127.0.0.1:8000/api/tasks/’,{ headers:{"Authorization":`Token ${this.state.token}`}, author:this.state.id, title:this.state.title, desc:this.state.desc, done:false, }) .then( response =>{console.log(response);} ) .then( ()=>{window.location.reload(false);} ) } Everything works fine but when i change AllowAny to IsAuthenticated in code below: REST_FRAMEWORK = { ‘DEFAULT_PERMISSION_CLASSES’: [ ‘rest_framework.permissions.IsAuthenticated’, ], ‘DEFAULT_AUTHENTICATION_CLASSES’: [ […]

Sending files via axios to backend

I have a problem with sending the mp3 file using axios to the backend, everything seems fine when I do console logs on the front, everything is in it, unfortunately on the backend the file field is empty (not null not undefined, just empty). front console log: backend console log: API: const API = axios.create({baseUrl: […]

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.