score:0
Accepted answer
You can give the approach below a whirl.
export const getUserOrders = async userId => {
const header = {
"Content-Type": "application/json;charset=utf-8",
};
let id = userId;
const URL = `http://127.0.0.1:8000/admindashboard/userorders/`
return dispatch => {
try {
dispatch(getUserOrdersStart())
const response = await axios(URL,id, {
method: "GET",
mode: "cors",
headers: header,
});
const jsonResponse = response.json();
dispatch(getUserOrdersSuccess(order))
} catch (error) {
setError(error);
}
};
score:0
Try adding CORS headers
Use this package and read the docs
Source: stackoverflow.com
Related Query
- how to send data in GET request header using react and axios to Django rest framework?
- How to send user data and its profile image using POST request from axios api to Django Rest Framework?
- How to get a data after react select using axios and ReactJS?
- How to send data from react and use the request body in express, using Axios?
- How to send data and photo at same time to node js backend using axios in react js
- How to upload file to Django rest framework API using Axios and react hook form?
- Making an axios get request and using React useState but when logging the data it still shows null
- How to simultaneously send and get data in React using axios?
- How to concatenate URL and string, and get data from API at click a button using axios in REACT JS
- How do I store JWT and send them with every request using react
- How to send body data and headers with axios get request?
- How do I access data returned from an axios get to display on a web page using react js?
- How to send CSRF Cookie from React to Django Rest Framework with Axios
- how to display large list of data using reactJS as frontend and django rest framework as backend
- How to upload image to aws s3 using react and django rest framework
- How to Assign react redux state api get data using axios
- Django Rest Framework and React Front End: How to prevent unauthorized users from viewing private images if they get a hold of the image URL?
- How to access data from get request made by a React functional component to localhost server using Axios?
- How to implement pagination in a Django and React app without using the REST framework?
- react js : axios fecth data using a get request condition : i want names with those values with taken: true
- Getting status code 304 on a get request with axios using react and redux
- How to pass data and header both in axios get request?
- take a csv file as input from user using React and send it as a post request using axios
- How to access data outside the function using axios and react js
- How to send data from Modal, Form using react and bootstrap?
- React and Express: Using Axios to GET data from 3rd party API
- How to send data using fetch and POST request with credentials included?
- Getting Bad request for POST request using Axios and CORS in Django and react app
- 403 Forbidden Error when trying to post and put a axios request in a web app using Django and React
- POST 400: Bad request - Using Django REST API and React
More Query from same tag
- Javascript, react hooks: access member property of member object using same function
- How context API with components made by map function
- react + Material ui makeStyles with '!important'
- using antd with redux-form
- Next.js, how to submit a form to another page?
- Webview causing react-native app to crash on navigation
- function called for every row in the datagrid although I want to call it only onClick in react
- React Cannot read property 'bind' of undefined from constructor/componentDidMount and Unable to set state on unmounted component
- How to call script.jsx to make react.js work
- ApexCharts Donut make the legend show all the items
- How to get last item in map function in React
- Redux middleware getting access to store
- How to show server - client communcation history with React
- What is the relationship between the React rendering cycle and the React component lifecycle?
- React syncing column width of between tables
- How to render multiple components with different component name?
- Force one selection checkboxe with REACT
- How to calculate the distance between differents lat long and display on map dynamically react native
- React how can i use @import
- How to open a modal within another modal in React?
- How to route users to separate standalone react apps using ExpressJS?
- React-intl const <FormattedMessage /> is giving [object object] as result
- how to "delete the textarea by clicking delete button" in reactjs
- How do I send custom data in react-router goBack method like push and replace methods?
- Inserting text with execCommand causes a duplication issue
- How can I access another function inside the react Context.Provider value?
- Returning an array to React component from fetch call in Redux
- Input check box not reacting to onChange function
- .glb file import in threejs shows black object
- Socket.io - React: How to display the users connected in a room?