How to use a prop from an auth route to gain props from a different route? (Django/React)

I'm creating a profile page with Django and react. The idea is that once a user is signed in, they go to a profile page and it sends a get request to http://localhost:8000/users/auth/user and then uses the props to populate the page. However, since this is a Django-created route, I need to use maybe data.username to link a different route that displays all the other props i need (such as bio, location) and then populate the rest of the profile with this.

Here is an example of the code:

fetch('http://localhost:8000/users/auth/users', {
          method: 'GET',
          headers: {
            'Content-Type': 'application/json',
            Authorization: `Token ${localStorage.getItem('token')}`
          }
        })
.then(data => {
              console.log(data)
            setUserName(data.username);

And somehow use data.username to fetch another route that displays my other props not located in auth.

How can I do this within the fetch/then format? Please let me know if further clarification is needed. Thank you!

Back to Top