Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 3611 | Rev 3630 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3611 Rev 3613
Línea 171... Línea 171...
171
 
171
 
172
  const deleteCommentHandler = (commentUnique, deleteCommentUrl) => {
172
  const deleteCommentHandler = (commentUnique, deleteCommentUrl) => {
173
    axios.post(deleteCommentUrl)
173
    axios.post(deleteCommentUrl)
174
      .then((res) => {
174
      .then((res) => {
175
        const { success, data, total_comments } = res.data;
175
        const { success, data, total_comments } = res.data;
176
        if (success) {
-
 
177
          const newCommentsState = commentsState.filter(
-
 
178
            (comment) => comment.unique !== commentUnique
-
 
179
          );
-
 
180
          setCommentsState(newCommentsState);
-
 
181
          setTotalComments(total_comments);
-
 
182
        } else {
176
        if (!success) {
183
          dispatch(addNotification({
177
          dispatch(addNotification({
184
            style: "danger",
178
            style: "danger",
185
            msg: data,
179
            msg: data,
186
          }));
180
          }));
-
 
181
        }
-
 
182
        setCommentsState(prevComments => prevComments.filter((comment) => comment.unique !== commentUnique));
-
 
183
        setTotalComments(total_comments);
187
        }
184
        dispatch(addNotification({ style: "success", msg: data }));
188
      })
185
      })
189
      .catch((error) => {
186
      .catch((error) =>
190
        dispatch(addNotification({
-
 
191
          style: "danger",
-
 
192
          msg: error.message,
-
 
193
        }));
187
        dispatch(addNotification({ style: "danger", msg: error.message }))
194
      });
188
      );
Línea 195... Línea 189...
195
  };
189
  };
196
 
190
 
197
  const btnShareHandler = () => {
191
  const btnShareHandler = () => {