Pass required props to refresh button and chart

pull/882/head
Chris Walsh 2021-12-04 02:01:57 -08:00
parent 51bf300eb4
commit 52666b3013
No known key found for this signature in database
GPG Key ID: 28EE0CCA6032019E
2 changed files with 3 additions and 1 deletions

View File

@ -16,11 +16,12 @@ function RefreshButton({ websiteId }) {
const [dateRange] = useDateRange(websiteId); const [dateRange] = useDateRange(websiteId);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const completed = useSelector(state => state.queries[`/api/website/${websiteId}/stats`]); const completed = useSelector(state => state.queries[`/api/website/${websiteId}/stats`]);
const createdAt = useSelector(state => state.websites[websiteId]?.createdAt);
function handleClick() { function handleClick() {
if (dateRange) { if (dateRange) {
setLoading(true); setLoading(true);
dispatch(setDateRange(websiteId, getDateRange(dateRange.value, locale))); dispatch(setDateRange(websiteId, getDateRange(dateRange.value, locale, createdAt)));
} }
} }

View File

@ -85,6 +85,7 @@ export default function WebsiteChart({
startDate={startDate} startDate={startDate}
endDate={endDate} endDate={endDate}
onChange={setDateRange} onChange={setDateRange}
websiteId={websiteId}
/> />
</div> </div>
</StickyHeader> </StickyHeader>