Request failed with status code 401
this is the error that i am getting in my react native application in response to this api call
const fetchData = async () => {
try {
const response = await axios.get(`${API_URL}/general-setting`, {
headers: {
'Accept': 'application/json',
}
});
const generalSetting = response.data.data.general_setting;
const newTheme = {
baseColor: `#${generalSetting.base_color}`,
secondColor: `#${generalSetting.secondary_color}`,
};
setTheme(newTheme);
} catch (error) {
Alert.alert('Error Fetching Theme', 'Please check your internet connection and try again.');
}
};
but in Postman or in the browser I am getting the response correctly. Here it is
Api response in postman
I tried the same api in browser, its working there also but not in my react native application