Skip to content

Commit

Permalink
Afegida comprovació per evitar eliminar el mateix usuari que ha inici…
Browse files Browse the repository at this point in the history
…at sessió
  • Loading branch information
albertms10 committed May 31, 2020
1 parent aa13f19 commit e79c6fa
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { Typography } from "antd";
import PropTypes from "prop-types";
import React from "react";
import { useSelector } from "react-redux";
import { Link } from "react-router-dom";
import { DropdownBorderlessButton } from "../../../../standalone/dropdown-borderless-button";
import { useEliminarSoci } from "../../hooks";

const { Text } = Typography;

const DropdownRowSoci = ({ idPersona, getSocis }) => {
const { currentUser } = useSelector(({ user }) => user);
const [showDeleteConfirm] = useEliminarSoci(getSocis);

return (
Expand All @@ -17,11 +19,15 @@ const DropdownRowSoci = ({ idPersona, getSocis }) => {
key: "detalls",
action: <Link to={`/socis/${idPersona}`}>Detalls</Link>,
},
{
key: "eliminar",
action: <Text type="danger">Eliminar</Text>,
onClick: () => showDeleteConfirm(idPersona),
},
...(currentUser.id_persona !== idPersona
? [
{
key: "eliminar",
action: <Text type="danger">Eliminar</Text>,
onClick: () => showDeleteConfirm(idPersona),
},
]
: []),
]}
/>
);
Expand Down

0 comments on commit e79c6fa

Please sign in to comment.