From 9aa2830d2b9fb3a7321b0614bf52d20bfae1ccb6 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Thu, 19 Oct 2023 17:01:21 -0700 Subject: [PATCH] Fixed test console. --- src/app/(main)/console/TestConsole.js | 15 +++++---------- src/app/(main)/console/[[...id]]/page.tsx | 4 ++-- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/app/(main)/console/TestConsole.js b/src/app/(main)/console/TestConsole.js index 1ae3eaf1..b88bfd77 100644 --- a/src/app/(main)/console/TestConsole.js +++ b/src/app/(main)/console/TestConsole.js @@ -7,19 +7,15 @@ import WebsiteChart from '../../(main)/websites/[id]/WebsiteChart'; import useApi from 'components/hooks/useApi'; import Head from 'next/head'; import Link from 'next/link'; -import { useRouter } from 'next/navigation'; +import useNavigation from 'components/hooks/useNavigation'; import Script from 'next/script'; import { Button } from 'react-basics'; import styles from './TestConsole.module.css'; -export function TestConsole() { +export function TestConsole({ websiteId }) { const { get, useQuery } = useApi(); const { data, isLoading, error } = useQuery(['websites:me'], () => get('/me/websites')); - const router = useRouter(); - const { - basePath, - query: { id }, - } = router; + const { router } = useNavigation(); function handleChange(value) { router.push(`/console/${value}`); @@ -72,7 +68,6 @@ export function TestConsole() { return null; } - const [websiteId] = id || []; const website = data?.data.find(({ id }) => websiteId === id); return ( @@ -87,8 +82,8 @@ export function TestConsole() { <>