IONIC CAPACITOR AND REACT FOR NATIVE AND WEB APPS
When I m fetching photo data from google api with that code below. It works good but when i inspect on website i can see on photo src my APIKEY how can i solve that or what i should do ?
const fetchPhoto = async () => {
if (photoName) {
try {
const maxHeightPx = 500;
const maxWidthPx = 500;
const url = `https://places.googleapis.com/v1/${photoName}/media?key=${GOOGLE_PLACES_API_KEY}&maxHeightPx=${maxHeightPx}&maxWidthPx=${maxWidthPx}`;
const response = await CapacitorHttp.post({ url });
setPhoto(response.url);
setLoading(false);
} catch (error) {
setPhoto(images.thumbnail);
setLoading(false);
console.error("Error while fetching photo:", error);
}
}
};
I dont know what to do
2
Answers
Okey guys. I solved that problem. I just need to change POST method to GET method. Then I got good results.