mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 15:17:23 +01:00
Created share token hook.
This commit is contained in:
parent
4119e80a9a
commit
5a73c224b7
22 changed files with 90 additions and 49 deletions
|
|
@ -3,12 +3,15 @@ import { FormattedMessage } from 'react-intl';
|
|||
import classNames from 'classnames';
|
||||
import useFetch from 'hooks/useFetch';
|
||||
import Dot from 'components/common/Dot';
|
||||
import { TOKEN_HEADER } from 'lib/constants';
|
||||
import useShareToken from 'hooks/useShareToken';
|
||||
import styles from './ActiveUsers.module.css';
|
||||
|
||||
export default function ActiveUsers({ websiteId, token, className }) {
|
||||
export default function ActiveUsers({ websiteId, className }) {
|
||||
const shareToken = useShareToken();
|
||||
const { data } = useFetch(`/api/website/${websiteId}/active`, {
|
||||
params: { token },
|
||||
interval: 60000,
|
||||
headers: { [TOKEN_HEADER]: shareToken?.token },
|
||||
});
|
||||
const count = useMemo(() => {
|
||||
return data?.[0]?.x || 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue