Added refs to the routes index.jsx

This commit is contained in:
Mathias Wagner 2023-06-02 17:07:43 +02:00
parent 01c8d01783
commit 4069e08df1
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -14,6 +14,7 @@ import QRCode from "@/pages/tools/general/QRCode";
import InstallSoftware from "@/pages/tools/linux/InstallSoftware"; import InstallSoftware from "@/pages/tools/linux/InstallSoftware";
import RemoteSSH from "@/pages/tools/linux/RemoteSSH"; import RemoteSSH from "@/pages/tools/linux/RemoteSSH";
import RemoteSFTP from "@/pages/tools/linux/RemoteSFTP"; import RemoteSFTP from "@/pages/tools/linux/RemoteSFTP";
import {createRef} from "react";
export const routes = { export const routes = {
Allgemein: [ Allgemein: [
@ -21,13 +22,15 @@ export const routes = {
path: '/', path: '/',
name: 'Was ist das?', name: 'Was ist das?',
icon: faQuestionCircle, icon: faQuestionCircle,
component: <Home /> component: <Home />,
ref: createRef()
}, },
{ {
path: '/qr', path: '/qr',
name: 'QR-Code erstellen', name: 'QR-Code erstellen',
icon: faQrcode, icon: faQrcode,
component: <QRCode /> component: <QRCode />,
ref: createRef()
} }
], ],
Base64: [ Base64: [
@ -35,13 +38,15 @@ export const routes = {
path: '/base64/encode', path: '/base64/encode',
name: 'Base64 Encode', name: 'Base64 Encode',
icon: faLock, icon: faLock,
component: <Encoder /> component: <Encoder />,
ref: createRef()
}, },
{ {
path: '/base64/decode', path: '/base64/decode',
name: 'Base64 Decode', name: 'Base64 Decode',
icon: faUnlock, icon: faUnlock,
component: <Decoder /> component: <Decoder />,
ref: createRef()
} }
], ],
Linux: [ Linux: [
@ -49,19 +54,22 @@ export const routes = {
path: '/linux/ssh', path: '/linux/ssh',
name: 'Remote-SSH', name: 'Remote-SSH',
icon: faTerminal, icon: faTerminal,
component: <RemoteSSH /> component: <RemoteSSH />,
ref: createRef()
}, },
{ {
path: '/linux/sftp', path: '/linux/sftp',
name: 'Remote-SFTP', name: 'Remote-SFTP',
icon: faFolder, icon: faFolder,
component: <RemoteSFTP /> component: <RemoteSFTP />,
ref: createRef()
}, },
{ {
path: '/linux/software', path: '/linux/software',
name: 'Software', name: 'Software',
icon: faBox, icon: faBox,
component: <InstallSoftware /> component: <InstallSoftware />,
ref: createRef()
} }
] ]
} }
@ -72,6 +80,10 @@ export const getByPath = (path) => {
routes[key].forEach(route => { routes[key].forEach(route => {
if (route.path === path) result = {...route, category: key} if (route.path === path) result = {...route, category: key}
}) })
}) });
if (result === null)
result = {path: "/404", name: "404", icon: faQuestionCircle, ref: createRef()}
return result; return result;
} }