我尝试将图像发送到我的Firebase存储,但他不发送图像,而我也无法获得他的下载网址:
updateChannelPicture(channelKey, image) { // image send me a data_url
var promise = new Promise((resolve, reject) => {
const channelPicturesRef = firebase.storage().ref('channels/' + channelKey);
channelPicturesRef.putString(image, 'data_url').then((res) => {
console.log('Save image: ', res.downloadURL); // At this console he return undefined
resolve({ success: true, picUrl: res.downloadURL });
}).catch((err) => {
console.log('Error save image: ', err);
resolve({ success: false, error: err.message });
});
});
return promise;
}