B: Correctly process invalid manuals topic name
Some checks are pending
Frontend CI / build (22.x) (push) Waiting to run

This commit is contained in:
Ivan 2024-09-26 11:39:14 +03:00
parent 67f2a9f325
commit 53e93dbab0
3 changed files with 15 additions and 0 deletions

View File

@ -28,6 +28,10 @@ export const Router = createBrowserRouter([
path: '',
element: <HomePage />
},
{
path: `${routes.not_found}`,
element: <NotFoundPage />
},
{
path: routes.login,
element: <LoginPage />

View File

@ -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: '/',

View File

@ -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));