mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 14:17:13 +01:00
Website components. Update chart component.
This commit is contained in:
parent
d81ee3932d
commit
bdcdcd9d13
9 changed files with 165 additions and 43 deletions
25
components/WebsiteStats.js
Normal file
25
components/WebsiteStats.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import PageviewsChart from './PageviewsChart';
|
||||
import { get } from 'lib/web';
|
||||
import { getTimezone } from 'lib/date';
|
||||
|
||||
export default function WebsiteStats({ websiteId, startDate, endDate, unit }) {
|
||||
const [data, setData] = useState();
|
||||
|
||||
async function loadData() {
|
||||
setData(
|
||||
await get(`/api/website/${websiteId}/pageviews`, {
|
||||
start_at: +startDate,
|
||||
end_at: +endDate,
|
||||
unit,
|
||||
tz: getTimezone(),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
loadData();
|
||||
}, [websiteId, startDate, endDate]);
|
||||
|
||||
return <PageviewsChart data={data} />;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue