Skip to content

Commit

Permalink
Remove now redundant if-statement
Browse files Browse the repository at this point in the history
  • Loading branch information
YetAnotherClown committed Jul 16, 2024
1 parent be6d501 commit 0483f56
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions docusaurus-plugin-moonwave/src/components/Redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@ import { Redirect as RouterRedirect } from "@docusaurus/router"
import React from "react"

export default function Redirect({ sidebarClassNames, pluginOptions }) {
if (sidebarClassNames.length > 0) {
for (let index = 0; index < sidebarClassNames.length; index++) {
const element = sidebarClassNames[index]
if (element.type == "category" && element.items.length === 0) {
continue
}
for (let index = 0; index < sidebarClassNames.length; index++) {
const element = sidebarClassNames[index]
if (element.type == "category" && element.items.length === 0) {
continue
}

const firstLuaClassName = (
element.type === "link" ? element.label : element.items[0].label
).replace(/[\u200B]/g, "") // Strip out any extraneous 0-width spaces
const firstLuaClassName = (
element.type === "link" ? element.label : element.items[0].label
).replace(/[\u200B]/g, "") // Strip out any extraneous 0-width spaces

return (
<RouterRedirect
to={`${pluginOptions.baseUrl}api/${firstLuaClassName}`}
/>
)
}
return (
<RouterRedirect to={`${pluginOptions.baseUrl}api/${firstLuaClassName}`} />
)
}

return <RouterRedirect to={`${pluginOptions.baseUrl}api/404`} />
Expand Down

0 comments on commit 0483f56

Please # to comment.