Skip to content

Commit

Permalink
chore: removed console log
Browse files Browse the repository at this point in the history
  • Loading branch information
davidicus committed Nov 4, 2023
1 parent 35548d0 commit 149f5d5
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/components/ViewingsList/ViewingsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,13 @@ const ViewingsList = ({
const [hasUnsavedData, setHasUnsavedData] = React.useState('');
const [oldState, setOldState] = React.useState<ViewingsListCardProps | string>();
React.useEffect(() => {
console.log("viewings from viewings effect", viewings)
setViewingsList(viewings);
}, [viewings]);
const { addViewingsBtnLabel = 'ADD VIEWINGS' } = i18n;
const handleOnAdd = () => {
const uuid = `${getRandomNum()}${viewingList ? '-' + viewingList.length : ''}`;
setHasUnsavedData(uuid);
setOldState(uuid)
setOldState(uuid);
if (onAdd) onAdd(uuid);
};

Expand All @@ -96,8 +95,8 @@ const ViewingsList = ({
};

const handleOnEdit = (viewingId: string) => {
setHasUnsavedData(viewingId)
setOldState(viewingList?.find((view) => view.id === viewingId))
setHasUnsavedData(viewingId);
setOldState(viewingList?.find((view) => view.id === viewingId));
};

const handleOnSave = (e: React.MouseEvent<HTMLElement>) => {
Expand All @@ -108,9 +107,9 @@ const ViewingsList = ({

const handleOnCancel = () => {
if (typeof oldState === 'string') {
typeof onDelete === 'function' && onDelete(oldState)
typeof onDelete === 'function' && onDelete(oldState);
} else if (hasUnsavedData === oldState?.id) {
setViewingsList(prevViewings => prevViewings?.map(el => el.id === oldState.id ? oldState : el));
setViewingsList((prevViewings) => prevViewings?.map((el) => (el.id === oldState.id ? oldState : el)));
}
setHasUnsavedData('');
};
Expand Down

0 comments on commit 149f5d5

Please sign in to comment.