web/firebase/index.js
/**
 * Pushes a single image file to the Firebase storage module's /images/... reference
 * @param {object} file - the image file to be pushed to Firebase
 */
Pushes a single image file to the Firebase storage module's /images/... reference
@param {object} file - the image file to be pushed to Firebase
Pushes a single image file to the Firebase storage module ' s / images / ... reference @param { object } file - the image file to be pushed to Firebase
function pushFileToFirebase(file) {
  var storageRef = firebase.storage().ref("images/" + file.name)
  storageRef.put(file).then(function (snapshot) {
    console.log("Uploaded file " + file.name + " with size of " + snapshot.totalBytes + " bytes.");
    snapshot.ref.getDownloadURL().then(function (url) {
      attachImageToUser(url);
    });
  }).catch(function (error) {
    console.error("Upload failed:", error);
  });
}
function pushFileToFirebase ( file ) { var storageRef = firebase . storage ( ) . ref ( "images/" + file . name ) storageRef . put ( file ) . then ( function ( snapshot ) { console . log ( "Uploaded file " + file . name + " with size of " + snapshot . totalBytes + " bytes." ) ; snapshot . ref . getDownloadURL ( ) . then ( function ( url ) { attachImageToUser ( url ) ; } ) ; } ) . catch ( function ( error ) { console . error ( "Upload failed:" , error ) ; } ) ; }
Pushes a single image file to the Firebase storage module's /images/... reference
 @param {object} file - the image file to be pushed to Firebase
Pushes a single image file to the Firebase storage module ' s / images / ... reference @param { object } file - the image file to be pushed to Firebase
// a storage reference is needed to specify exactly where the file is going // it can be thought of as a filepath with directories of where the file is // going to be stored // push the file to firebase storage // let's grab the download url... // ...and attach that image url to the users' Firestore subcollections