Is there a way to delete an image from Firebase storage using its URL? I have noticed that when I remove an item (category) from the collection, the image associated with it remains in storage.
This is the interface for category:
export interface ICategory {
readonly id : string
name : string
image : string
}
Here is the function for removing categories:
export const removeCategoryFB = (id: string, setCategories: any) => {
firestore()
.collection("categories")
.doc(id)
.delete()
.then(() => {
getCategoriesFB(setCategories);
})
.catch((err) => {
alert(err);
});
};