i want to call the basic authentication rest api in the react native.how to pass basic authentication headers.getting error - unhandled promise rejection - cant find base64 variable
getDataFromAPI=async()=>
{
var headers = new Headers();
headers.append("Authorization", "Basic " + base64.encode("admin:admin@123"));
const endpoint='url'
const res=await fetch (endpoint,{headers:headers})
const data=await res.json()
this.setState({items:data})
}
_renderItem=({item,index})=>{
let{cardText,card,cardImage}= styles
return (
<TouchableOpacity style={card}>
<Text style={cardText}>{item.id} Reactor Status: {item.ph}</Text>
</TouchableOpacity>
)
}