From ec1a440b2821b00b2951edcb6787f4db7f087b8a Mon Sep 17 00:00:00 2001
From: Lucas Schoenfelder <les17@inf.ufpr.br>
Date: Thu, 18 Feb 2021 11:36:50 -0300
Subject: [PATCH] fixed modal not closing on success

---
 src/Components/ModalAlterarAvatar/ComponentAlterarAvatar.js | 2 +-
 src/Components/ModalAlterarCover/ComponentAlterarCover.js   | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/Components/ModalAlterarAvatar/ComponentAlterarAvatar.js b/src/Components/ModalAlterarAvatar/ComponentAlterarAvatar.js
index 68f404b4..294bcdb0 100644
--- a/src/Components/ModalAlterarAvatar/ComponentAlterarAvatar.js
+++ b/src/Components/ModalAlterarAvatar/ComponentAlterarAvatar.js
@@ -89,7 +89,7 @@ export default function ComponentAlterarAvatar (props) {
 
     function handleSuccess(data) {
         const target = state.currentUser
-        const source = {userAvatar : data.avatar}
+        const source = {avatar : data.avatar}
         dispatch({
             type : 'USER_CHANGED_COVER',
             currUser : Object.assign(target, source)
diff --git a/src/Components/ModalAlterarCover/ComponentAlterarCover.js b/src/Components/ModalAlterarCover/ComponentAlterarCover.js
index 99a5f549..a4059ecf 100644
--- a/src/Components/ModalAlterarCover/ComponentAlterarCover.js
+++ b/src/Components/ModalAlterarCover/ComponentAlterarCover.js
@@ -39,11 +39,12 @@ export default function ComponentAlterarCover (props) {
 
     function handleSuccess (data) {
         const target = state.currentUser
-        const source = {userCover : data.cover}
+        const source = {cover : data.cover}
         dispatch({
             type : 'USER_CHANGED_COVER',
             currUser : Object.assign(target, source)
         })
+        props.handleClose()
     }
 
     const completeSelection = () => {
-- 
GitLab