mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-06-03 07:42:03 +00:00
Add error toast for missing naddress in course slugs
This commit is contained in:
parent
4f093b9e2c
commit
06780ffaa5
@ -188,14 +188,16 @@ const Course = () => {
|
||||
const navbarHeight = 60; // Match the height from Navbar component
|
||||
|
||||
useEffect(() => {
|
||||
if (router.isReady) {
|
||||
if (router.isReady && router.query.slug) {
|
||||
const { slug } = router.query;
|
||||
if (slug.includes('naddr')) {
|
||||
setNAddress(slug);
|
||||
} else {
|
||||
console.warn('No naddress found in slug');
|
||||
showToast('error', 'Error', 'Course identifier not found in URL');
|
||||
router.push('/courses'); // Redirect to courses page
|
||||
setTimeout(() => {
|
||||
router.push('/courses'); // Redirect to courses page
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
}, [router.isReady, router.query.slug, showToast, router]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user