mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
fix active users not appear
This commit is contained in:
parent
2b4ddb5388
commit
4a484286db
2 changed files with 8 additions and 4 deletions
|
|
@ -9,14 +9,18 @@ import styles from './ActiveUsers.module.css';
|
|||
|
||||
export default function ActiveUsers({ websiteId, className, value, interval = 60000 }) {
|
||||
const shareToken = useShareToken();
|
||||
const url = value !== undefined && websiteId ? `/website/${websiteId}/active` : null;
|
||||
const url = websiteId ? `/website/${websiteId}/active` : null;
|
||||
const { data } = useFetch(url, {
|
||||
interval,
|
||||
headers: { [TOKEN_HEADER]: shareToken?.token },
|
||||
});
|
||||
const count = useMemo(() => {
|
||||
return value || data?.[0]?.x || 0;
|
||||
}, [data, value]);
|
||||
if (websiteId) {
|
||||
return data?.[0]?.x || 0
|
||||
}
|
||||
|
||||
return value !== undefined ? value : 0;
|
||||
}, [data, value, websiteId]);
|
||||
|
||||
if (count === 0) {
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue