Update src/pages/course/[slug]/index.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Austin Kelsay 2025-04-24 12:18:35 -05:00 committed by austinkelsay
parent 9f784f3984
commit 4f093b9e2c
No known key found for this signature in database
GPG Key ID: 5A763922E5BA08EE

View File

@ -193,10 +193,12 @@ const Course = () => {
if (slug.includes('naddr')) {
setNAddress(slug);
} else {
// todo: no naddress?
console.warn('No naddress found in slug');
showToast('error', 'Error', 'Course identifier not found in URL');
router.push('/courses'); // Redirect to courses page
}
}
}, [router.isReady, router.query.slug]);
}, [router.isReady, router.query.slug, showToast, router]);
useEffect(() => {
if (router.isReady) {