How can I access the return value of a Flask route within a Javascript file?

The problem I’m having is accessing the value within the return statement in the flask route (resp[“login”]). I’m trying to use this value in a javascript file and use it as a query parameter. But whenever i try the console.log() in the javascript file I get a promise object. But I am not able to find where I could find the value coming in from the Flask app. I thought it would be within the response object below but no such luck.

@app.route('/route', methods=['GET', 'POST'])
@cross_origin(supports_credentials=True)
def handle_callback():

    if request.method == 'POST':

        payload = {
            blahhh
        }
        headers = {'Accept': 'application/json', 'Access-Control-Allow-Origin': '*'}
        req = requests.post(token_url, params=payload, headers=headers)
        # make another request after this using access token with updated header field 
        resp = req.json()

        if 'access_token' in resp:
            oauthHeader = "token " + resp['blahhh']
            headers = {'Authorization': oauthHeader}
            access_token_url = 'https://blahhh.com'
            r = requests.get(url=access_token_url, headers=headers)
            resp = r.json()
            return resp["login"]
        else:
            return "error", 404
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const codeGit = urlParams.get('code')

const sub = {codeGit};
 

const res = fetch('http://localhost:4000/route', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Access-Control-Allow-Origin': '*',
        'code': codeGit
    },
    credentials: 'include'
}).then(response => {
    if(response.status == 200){
        console.log('Success! ' + response.json() )
    }
}).catch(error => {
    console.log('error with access token req!')
})

console.log(res)