[Vuejs]-Passing firebase downloadURL to a local variable

0๐Ÿ‘

โœ…

// ...
data() {
   image_url: ''
},
methods: {
  var self = this;
  createOrUpdateUser: function () {
      //... your code
      uploadTask.on('state_changed', function(snapshot){

      }, function(error) {

      // Handle unsuccessful uploads
      }, function() {

      // Handle successful uploads on complete
      // For instance, get the download URL: https://firebasestorage.googleapis.com/...

      uploadTask.snapshot.ref.getDownloadURL().then(function(downloadURL) {
         //i need to pass downloadURL to the image_url variable above...
         self.image_url = downloadURL
         console.log('File available at', downloadURL);
       });
    });

    }
  }
๐Ÿ‘คmark922

Leave a comment