diff --git a/components/common/RefreshButton.js b/components/common/RefreshButton.js index ce4c4f19..2d948cde 100644 --- a/components/common/RefreshButton.js +++ b/components/common/RefreshButton.js @@ -1,19 +1,27 @@ -import React from 'react'; -import { useDispatch } from 'react-redux'; +import React, { useState, useEffect } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; import { setDateRange } from 'redux/actions/websites'; import Button from './Button'; import Refresh from 'assets/redo.svg'; +import Dots from 'assets/ellipsis-h.svg'; import { useDateRange } from 'hooks/useDateRange'; export default function RefreshButton({ websiteId }) { const dispatch = useDispatch(); const dateRange = useDateRange(websiteId); + const [loading, setLoading] = useState(false); + const completed = useSelector(state => state.queries[`/api/website/${websiteId}/metrics`]); function handleClick() { if (dateRange) { + setLoading(true); dispatch(setDateRange(websiteId, dateRange)); } } - return