-
Notifications
You must be signed in to change notification settings - Fork 0
react cognito
Vaquar Khan edited this page Jan 15, 2022
·
1 revision
fetch('URL', {
method: 'post',
headers: new Headers({
'Authorization': 'Bearer <Bearer token>',
'Content-Type': 'application/json'
}),
body: '<BODY>'
});
const getStoreDetails = async () => {
setIsLoading(true);
const axiosConfig = {
headers: {
"Content-Type": "application/json",
},
};
await axios
.get(STORE_DETAIL + STORE_USER_NAME, axiosConfig)
.then((response) => {
// console.log("++++++ Store Details Response: ++++++ /n " + JSON.stringify(response.data));
if (response != null) {
setStoreDetails(response.data);
localStorage.setItem('EzyStoreDetails', JSON.stringify(response.data));
}
setIsLoading(false);
})
.catch((error) => {
if (error.response) {
setIsLoading(false);
console.log(error.response.data);
console.log(error.response.status);
console.log(error.response.headers);
}
});
};
const axiosConfig = {
headers: {
"Content-Type": "application/json",
"Authorization': 'Bearer <Bearer token>",
},
};