Skip to content

Commit

Permalink
add dispatch action to close dialog, remove redunt dispatch (#3726)
Browse files Browse the repository at this point in the history
  • Loading branch information
meghna0593 authored Dec 2, 2024
1 parent 1366c8e commit 7d780df
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/src/UI/OfflineDataSync/OfflineDataSyncTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { Button, IconButton, LinearProgress } from '@mui/material';
import { OfflineActivityRecord, selectOfflineActivity } from 'state/reducers/offlineActivity';
import { useSelector } from 'utils/use_selector';
import { useDispatch } from 'react-redux';
import { ACTIVITY_OFFLINE_DELETE_ITEM, ACTIVITY_RUN_OFFLINE_SYNC } from 'state/actions';
import {
ACTIVITY_OFFLINE_DELETE_ITEM,
ACTIVITY_OFFLINE_SYNC_DIALOG_SET_STATE,
ACTIVITY_RUN_OFFLINE_SYNC
} from 'state/actions';
import Delete from '@mui/icons-material/Delete';
import './OfflineDataSync.css';
import moment from 'moment';
Expand All @@ -16,7 +20,6 @@ export const OfflineDataSyncTable = () => {
const { working, serializedActivities } = useSelector(selectOfflineActivity);
const { authenticated, workingOffline } = useSelector((state) => state.Auth);
const connected = useSelector((state) => state.Network.connected);

const [syncDisabled, setSyncDisabled] = useState(false);

const history = useHistory();
Expand Down Expand Up @@ -63,8 +66,8 @@ export const OfflineDataSyncTable = () => {
disabled={!(workingOffline || authenticated)}
color="primary"
onClick={() => {
dispatch(Activity.getLocal(key));
history.push(`/Records/Activity:${key}/form`);
dispatch({ type: ACTIVITY_OFFLINE_SYNC_DIALOG_SET_STATE, payload: { open: false } });
}}
>
<FileOpen></FileOpen>
Expand Down

0 comments on commit 7d780df

Please sign in to comment.