score:1
Accepted answer
i see in the swagger that userid is in the same level as email, phone ..., i think it should work like this:
export default function newrequest() {
const [userdata, setuserdata] = usestate({
firstname: "",
surname: "",
co: "",
homeaddress: "",
postcode: "",
city: "",
country: "",
phoneprefix: "",
phonenumber: "",
email: "",
approver1lvl: "",
employeeid: "",
userid: ""
});
const handlesubmit = () => {
var token = localstorage.getitem("msal.idtoken");
var jwt = jwt_decode(token);
const {
firstname,
surname,
co,
homeaddress,
postcode,
city,
country,
phoneprefix,
phonenumber,
email,
approver1lvl,
employeeid,
date,
} = userdata;
const user = {
firstname,
surname,
co,
homeaddress,
postcode,
city,
country,
phoneprefix,
phonenumber,
email,
approver1lvl,
employeeid,
birth,
};
custominstance.post("request", {...user, userid: jwt.oid}).then((response) => {});
};
Source: stackoverflow.com
Related Query
- Sending a MSAL token to backend using Axios
- Sending a csv from front-end to backend using axios
- Sending Form Data From Frontend to Backend Using Axios Using React
- sending input value to backend using react & axios
- Sending image to backend using multar post and axios
- Sending the bearer token with axios
- correctly redirect user if refresh token has expired using axios
- $_FILES is empty when sending a POST request using axios in ReactJs
- How to fix failing test when using axios cancel token in useEffect hook
- Application does not fetch access token from cache using MSAL (react-aad-msal)
- Issues connecting to my Node.js and MongoDB backend using a React and axios front end
- How to set cookie with JWT token in ReactJS frontend using Node, Express, Axios
- Input undefined when sending post request to the nodejs api using react and axios
- How to send data and photo at same time to node js backend using axios in react js
- How to send token through headers by using axios post method in react
- MSAL JS throws multiple_matching_tokens_detected exception while renewing id token using acquireTokenSilent function
- Trouble getting an Authentication Token using Axios for React
- Downloading Excel data using Axios from Laravel backend is not working
- I am working in an ecommerce project using react.I am not able to fetch products from backend using the axios
- Adding rows as objects to the key and sending to backend using react
- Axios: Using baseUrl in a separate file causes problems with setting authentication token in axios request headers
- Axios FormData is sending null values to backend
- sending multiple objects using axios
- Sending session data to React frontend using Larvel backend
- Sending FormData from ReactJs to NodeJs controller using axios
- Request a data to Backend by using Fetch 'Get' (with this error message Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0)
- Access-Control-Allow-Origin not present in header when posting using Axios in ReactJs to a Laravel Backend
- Sending request to elasticsearch using axios to map cards
- How to pass Token of the first request response to the second request header, using Axios in an Ionic React app (2 Post Requests)
- React Invalid Token getting unauthorized, using axios , also unable to logout
More Query from same tag
- React using external css along with bootsrap framework classes
- How do I run .map() starting from the second index onward?
- FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory node.js
- Why will my SVG not vertically align in React Bootstrap?
- React Trouble updating state with useReducer
- Why is my class not applying to a certain element is sass
- Open Specific Menu in ReactJS
- Deploy to Heroku PG::DuplicateColumn: ERROR:
- React bind issue with ES6
- Css effects is not working in react application
- material ui app bar not showing - reactjs
- Firestore Cloud Function returns undefined to client when I perform axios post operation
- Access api from a CMS in Next.js
- How can I remove a className from a component when entering another component in react
- React login error message returns undefined on first call then displays error on second call
- How can I use unirest API calls in React?
- Delete `␍`eslintprettier/prettier
- When runing 'npm run build' I get an error that says "'CI' is not recognized"
- TypeScript error while accessing Proxy Object | Object[] in MobX
- how to run Json server along with ReactJS on same port
- Proper way of declaring React props in a constructor that are never used
- Material UI Tab loosing connection to Tabs when wrapped inside another component
- Handling API calls using useEffect vs using useCallback
- how to call parent function controller from directive react component angularjs + reactjs?
- Is it possible to achieve something like HOC with classes - without classes in React?
- Using ES6 Map with React and/or Redux
- How can i get multiple div's on a single page in react?
- how can I set edit box values (in react application) by clicking on a link in an email?
- Is it possible to type a React function component with TypeScript without using arrow functions?
- using react: TypeError: value.products.map is not a function