Refresh should reset date range.

This commit is contained in:
Mike Cao 2020-09-03 08:42:08 -07:00
parent c984f4c6ae
commit fd8df387c8

View File

@ -5,6 +5,7 @@ import Button from './Button';
import Refresh from 'assets/redo.svg'; import Refresh from 'assets/redo.svg';
import Dots from 'assets/ellipsis-h.svg'; import Dots from 'assets/ellipsis-h.svg';
import { useDateRange } from 'hooks/useDateRange'; import { useDateRange } from 'hooks/useDateRange';
import { getDateRange } from '../../lib/date';
export default function RefreshButton({ websiteId }) { export default function RefreshButton({ websiteId }) {
const dispatch = useDispatch(); const dispatch = useDispatch();
@ -15,7 +16,7 @@ export default function RefreshButton({ websiteId }) {
function handleClick() { function handleClick() {
if (dateRange) { if (dateRange) {
setLoading(true); setLoading(true);
dispatch(setDateRange(websiteId, dateRange)); dispatch(setDateRange(websiteId, getDateRange(dateRange.value)));
} }
} }