Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Your web app's Firebase configuration
- var firebaseConfig = {
- apiKey: "",
- authDomain: "",
- databaseURL: "",
- projectId: "",
- storageBucket: "",
- messagingSenderId: "",
- appId: ""
- };
- // Initialize Firebase
- firebase.initializeApp(firebaseConfig);
- var storage = firebase.storage();
- var storageRef = storage.ref();
- //! List All Albums
- storageRef
- .listAll()
- .then(result => {
- result.prefixes.forEach(element => {
- displayAlbum(storageRef.child(`${element.fullPath}`));
- // console.log(element.fullPath);
- });
- })
- .catch(err => console.log(err));
- // List All Photos In That Album
- function displayAlbum(albumRef) {
- albumRef
- .listAll()
- .then(result => {
- result.items.forEach(element => {
- element
- .getDownloadURL()
- .then(url => console.log(url))
- .catch(err => console.log("Error In Getting"));
- });
- })
- .catch(err => console.log(err));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement