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