mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-06-05 00:32: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
|
const navbarHeight = 60; // Match the height from Navbar component
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (router.isReady) {
|
if (router.isReady && router.query.slug) {
|
||||||
const { slug } = router.query;
|
const { slug } = router.query;
|
||||||
if (slug.includes('naddr')) {
|
if (slug.includes('naddr')) {
|
||||||
setNAddress(slug);
|
setNAddress(slug);
|
||||||
} else {
|
} else {
|
||||||
console.warn('No naddress found in slug');
|
console.warn('No naddress found in slug');
|
||||||
showToast('error', 'Error', 'Course identifier not found in URL');
|
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]);
|
}, [router.isReady, router.query.slug, showToast, router]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user