Improve UI avatar and solve delete image bug
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
@@ -85,7 +85,7 @@ export const dbUpdateUserInfo = (newInfo) => {
|
||||
let info = getState().user.info[uid]
|
||||
let updatedInfo = {
|
||||
avatar: newInfo.avatar || info.avatar || '',
|
||||
banner: newInfo.banner || info.banner || '',
|
||||
banner: newInfo.banner || info.banner || 'https://firebasestorage.googleapis.com/v0/b/open-social-33d92.appspot.com/o/images%2F751145a1-9488-46fd-a97e-04018665a6d3.JPG?alt=media&token=1a1d5e21-5101-450e-9054-ea4a20e06c57',
|
||||
email: newInfo.email || info.email || '',
|
||||
fullName: newInfo.fullName || info.fullName || '',
|
||||
tagLine: newInfo.tagLine || info.tagLine || ''
|
||||
|
||||
Reference in New Issue
Block a user