Handle no image
This commit is contained in:
@@ -125,7 +125,7 @@ export const dbUploadImage = (file, fileName) => {
|
|||||||
|
|
||||||
// Upload file
|
// Upload file
|
||||||
var task = storegeFile.put(file)
|
var task = storegeFile.put(file)
|
||||||
dispatch(globalActions.showTopLoading())
|
dispatch(globalActions.showTopLoading())
|
||||||
|
|
||||||
// Upload storage bar
|
// Upload storage bar
|
||||||
task.on('state_changed', (snapshot) => {
|
task.on('state_changed', (snapshot) => {
|
||||||
@@ -135,13 +135,13 @@ export const dbUploadImage = (file, fileName) => {
|
|||||||
|
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
dispatch(globalActions.showErrorMessage(error.code))
|
dispatch(globalActions.showErrorMessage(error.code))
|
||||||
dispatch(globalActions.hideTopLoading())
|
dispatch(globalActions.hideTopLoading())
|
||||||
|
|
||||||
}, (complete) => {
|
}, (complete) => {
|
||||||
dispatch(globalActions.progressChange(100, false))
|
dispatch(globalActions.progressChange(100, false))
|
||||||
dispatch(dbSaveImage(fileName))
|
dispatch(dbSaveImage(fileName))
|
||||||
dispatch(globalActions.hideTopLoading())
|
dispatch(globalActions.hideTopLoading())
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,12 +151,14 @@ export const dbUploadImage = (file, fileName) => {
|
|||||||
* @param {string} fileName
|
* @param {string} fileName
|
||||||
*/
|
*/
|
||||||
export const dbDownloadImage = (fileName) => {
|
export const dbDownloadImage = (fileName) => {
|
||||||
|
if (fileName == 'noImage')
|
||||||
|
return
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
|
|
||||||
if (getState().imageGallery.imageURLList[fileName] && fileName !== '')
|
if (getState().imageGallery.imageURLList[fileName] && fileName !== '')
|
||||||
return
|
return
|
||||||
|
|
||||||
if(getState().imageGallery.imageRequests.indexOf(fileName) > -1)
|
if (getState().imageGallery.imageRequests.indexOf(fileName) > -1)
|
||||||
return
|
return
|
||||||
dispatch(sendImageRequest(fileName))
|
dispatch(sendImageRequest(fileName))
|
||||||
|
|
||||||
@@ -166,7 +168,7 @@ export const dbDownloadImage = (fileName) => {
|
|||||||
// Get the download URL
|
// Get the download URL
|
||||||
starsRef.getDownloadURL().then((url) => {
|
starsRef.getDownloadURL().then((url) => {
|
||||||
// Insert url into an <img> tag to "download"
|
// Insert url into an <img> tag to "download"
|
||||||
if (!getState().imageGallery.imageURLList[fileName] || fileName === '')
|
if (!getState().imageGallery.imageURLList[fileName] || fileName === '')
|
||||||
dispatch(setImageURL(fileName, url))
|
dispatch(setImageURL(fileName, url))
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user