Improve UI avatar and solve delete image bug

This commit is contained in:
Qolzam
2017-08-25 16:04:55 +07:00
parent bca0752535
commit b198717ae9
15 changed files with 51 additions and 35 deletions

View File

@@ -94,7 +94,7 @@ export const dbSaveImage = (imageURL,imageFullPath) => {
* Delete an image from database
* @param {string} id of image
*/
export const dbDeleteImage = (fullPath) => {
export const dbDeleteImage = (id) => {
return (dispatch, getState) => {
// Get current user id
@@ -102,11 +102,11 @@ export const dbDeleteImage = (fullPath) => {
// Write the new data simultaneously in the list
var updates = {};
updates[`userFiles/${uid}/files/${fullPath}`] = null;
updates[`userFiles/${uid}/files/images/${id}`] = null;
return firebaseRef.update(updates).then((result) => {
dispatch(deleteImage(fullPath))
console.log('image removed: ', fullPath);
dispatch(deleteImage(id))
console.log('image removed: ', id);
}, (error) => {
console.log(error);
});