Created share token hook.

This commit is contained in:
Mike Cao 2020-10-11 02:29:55 -07:00
parent 4119e80a9a
commit 5a73c224b7
22 changed files with 90 additions and 49 deletions

View file

@ -13,6 +13,7 @@ import useFetch from 'hooks/useFetch';
import useLocale from 'hooks/useLocale';
import useCountryNames from 'hooks/useCountryNames';
import { percentFilter } from 'lib/filters';
import { TOKEN_HEADER } from 'lib/constants';
import styles from './RealtimeDashboard.module.css';
const REALTIME_RANGE = 30;
@ -39,7 +40,7 @@ export default function RealtimeDashboard() {
params: { start_at: data?.timestamp },
disabled: !init?.websites?.length || !data,
interval: REALTIME_INTERVAL,
headers: { 'x-umami-token': init?.token },
headers: { [TOKEN_HEADER]: init?.token },
});
const renderCountryName = useCallback(({ x }) => countryNames[x], []);