0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix(console): fix dashboard date (#1274)

This commit is contained in:
Wang Sijie 2022-06-28 17:21:02 +08:00 committed by GitHub
parent 7871293e12
commit 8c0ceff574
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,6 +30,7 @@ const tickStyle = {
}; };
const Dashboard = () => { const Dashboard = () => {
const [date, setDate] = useState<string>(dayjs().format('YYYY-MM-DD'));
const { data: totalData, error: totalError } = useSWR<TotalUsersResponse, RequestError>( const { data: totalData, error: totalError } = useSWR<TotalUsersResponse, RequestError>(
'/api/dashboard/users/total' '/api/dashboard/users/total'
); );
@ -37,10 +38,9 @@ const Dashboard = () => {
'/api/dashboard/users/new' '/api/dashboard/users/new'
); );
const { data: activeData, error: activeError } = useSWR<ActiveUsersResponse, RequestError>( const { data: activeData, error: activeError } = useSWR<ActiveUsersResponse, RequestError>(
'/api/dashboard/users/active' `/api/dashboard/users/active?date=${date}`
); );
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
const [date, setDate] = useState<string>(dayjs().format('YYYY-MM-DD'));
// Pick an error as the page's error // Pick an error as the page's error
const error = totalError ?? newError ?? activeError; const error = totalError ?? newError ?? activeError;