In my header, I will send token for authentication to my back-end but I don't know how I can add header to get method ..
fetch('https://api.github.com/users/mralexgray/repos', {
method: 'GET',
headers: {
"Content-Type":"application/json",
"Accept": "application/json",
"X-Aequseted-With": "XMLHttpRequest",
"X-CSRF-TOKEN": token
}
}).then(result => {
return result.json()
}).catch(err => {
console.error(err);
});
in post method is clear, but in get method I have to get data from backend