B: Correctly process invalid manuals topic name
This commit is contained in:
parent
e1604bb7f8
commit
aeaa92df3f
|
@ -28,6 +28,10 @@ export const Router = createBrowserRouter([
|
|||
path: '',
|
||||
element: <HomePage />
|
||||
},
|
||||
{
|
||||
path: `${routes.not_found}`,
|
||||
element: <NotFoundPage />
|
||||
},
|
||||
{
|
||||
path: routes.login,
|
||||
element: <LoginPage />
|
||||
|
|
|
@ -8,6 +8,7 @@ import { buildConstants } from '@/utils/buildConstants';
|
|||
* Routes.
|
||||
*/
|
||||
export const routes = {
|
||||
not_found: 'not-found',
|
||||
login: 'login',
|
||||
signup: 'signup',
|
||||
profile: 'profile',
|
||||
|
@ -39,6 +40,7 @@ interface OssProps {
|
|||
* Internal navigation URLs.
|
||||
*/
|
||||
export const urls = {
|
||||
page404: '/not-found',
|
||||
admin: `${buildConstants.backend}/admin`,
|
||||
rest_api: `${buildConstants.backend}/`,
|
||||
home: '/',
|
||||
|
|
|
@ -7,6 +7,7 @@ import { useConceptOptions } from '@/context/ConceptOptionsContext';
|
|||
import { useConceptNavigation } from '@/context/NavigationContext';
|
||||
import useQueryStrings from '@/hooks/useQueryStrings';
|
||||
import { HelpTopic } from '@/models/miscellaneous';
|
||||
import { PARAMETER } from '@/utils/constants';
|
||||
|
||||
import TopicsList from './TopicsList';
|
||||
import ViewTopic from './ViewTopic';
|
||||
|
@ -18,6 +19,14 @@ function ManualsPage() {
|
|||
|
||||
const { mainHeight } = useConceptOptions();
|
||||
|
||||
if (!Object.values(HelpTopic).includes(activeTopic)) {
|
||||
setTimeout(() => {
|
||||
router.push(urls.page404);
|
||||
}, PARAMETER.refreshTimeout);
|
||||
console.log(1);
|
||||
return null;
|
||||
}
|
||||
|
||||
const onSelectTopic = useCallback(
|
||||
(newTopic: HelpTopic) => {
|
||||
router.push(urls.help_topic(newTopic));
|
||||
|
|
Loading…
Reference in New Issue
Block a user