i am wondering why the code below logs undefined to the console? i have already eliminated a backend issue because when i use the broswers developer tools to inspect this request everything seems fine and the response shown in the dev tools is the json data i was expecting. any help appreciated.
const url = window.location.href.split('/')
const url1 = url[6].substring(2)
fetch(`http://localhost:8080/apiget/userinfo/${url1}`)
.then(response=>{
response.json()
})
.then(json=>console.log(json))
.catch(error=>console.log('something went wrong'))