Skip to content

Commit

Permalink
use silent refresh and not reload window on delete device/batch
Browse files Browse the repository at this point in the history
  • Loading branch information
Codebmk committed Nov 23, 2023
1 parent 8dad5fa commit ecc4183
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Skeleton from './Skeleton';
import moment from 'moment';
import { useRouter } from 'next/router';
import Toast from '@/components/Toast';
import { useGetCollocationResultsQuery } from '@/lib/store/services/collocation';
import { getDeviceStatusSummary } from '@/lib/store/services/collocation';
import Dropdown from '@/components/Dropdowns/Dropdown';
import InfoIcon from '@/icons/Common/info_circle.svg';
import Modal from '@/components/Modal/Modal';
Expand Down Expand Up @@ -115,11 +115,9 @@ const DataTable = ({ filteredData, collocationDevices, isLoading }) => {
createAxiosInstance()
.delete(DELETE_COLLOCATION_DEVICE, { params: data })
.then((response) => {
dispatch(getDeviceStatusSummary());
setVisible(false);
setSuccessMessage(`Succesfully deleted batch ${batchId}`);
setTimeout(() => {
window.location.reload();
}, 2000);
})
.catch((error) => {
setVisible(false);
Expand All @@ -138,11 +136,9 @@ const DataTable = ({ filteredData, collocationDevices, isLoading }) => {
createAxiosInstance()
.delete(DELETE_COLLOCATION_DEVICE, { params: data })
.then((response) => {
dispatch(getDeviceStatusSummary());
setVisibleDeleteDevice(false);
setSuccessMessage(`Succesfully deleted device ${device}`);
setTimeout(() => {
window.location.reload();
}, 2000);
})
.catch((error) => {
setVisibleDeleteDevice(false);
Expand Down

0 comments on commit ecc4183

Please sign in to comment.