Skip to content

Commit

Permalink
refactor: close the manage slide-over when the media item is removed …
Browse files Browse the repository at this point in the history
…from the blacklist
  • Loading branch information
JoaquinOlivero committed Jul 16, 2024
1 parent a05e4aa commit 694be51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/BlacklistBlock/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ const messages = defineMessages('component.BlacklistBlock', {
interface BlacklistBlockProps {
blacklistItem: Blacklist;
onUpdate?: () => void;
onDelete?: () => void;
}

const BlacklistBlock = ({ blacklistItem, onUpdate }: BlacklistBlockProps) => {
const BlacklistBlock = ({
blacklistItem,
onUpdate,
onDelete,
}: BlacklistBlockProps) => {
const { user } = useUser();
const intl = useIntl();
const [isUpdating, setIsUpdating] = useState(false);
Expand Down Expand Up @@ -51,9 +56,8 @@ const BlacklistBlock = ({ blacklistItem, onUpdate }: BlacklistBlockProps) => {
});
}

if (onUpdate) {
onUpdate();
}
onUpdate && onUpdate();
onDelete && onDelete();

setIsUpdating(false);
};
Expand Down
1 change: 1 addition & 0 deletions src/components/ManageSlideOver/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ const ManageSlideOver = ({
<BlacklistBlock
blacklistItem={data.mediaInfo.blacklist}
onUpdate={() => revalidate()}
onDelete={() => onClose()}
/>
</div>
</div>
Expand Down

0 comments on commit 694be51

Please sign in to comment.