score:0

const token = localStorage.getItem('token');
fetch(url, {
        method: "POST", 
        headers: {
            "Content-Type": "application/json",
            'Authorization': `Bearer ${token}`,
        },
        body: JSON.stringify(data), // body data type must match "Content-Type" header
    })
    .then(response => response.json())

Related Query

More Query from same tag