Skip to content
Snippets Groups Projects
Commit 720cc905 authored by Dima Rifai's avatar Dima Rifai
Browse files

Issue #412 - Validate Account in route starts with @ and is not empty

parent 0031f69b
No related branches found
No related tags found
No related merge requests found
Pipeline #112376 failed
......@@ -20,6 +20,7 @@ import BalanceHistorySearch from "@/components/home/searches/BalanceHistorySearc
import { Card, CardHeader } from "@/components/ui/card";
import BalanceHistoryChart from "@/components/balanceHistory/BalanceHistoryChart";
import ErrorPage from "../ErrorPage";
// Memoizing the BalanceHistoryChart component to avoid unnecessary re-renders
const MemoizedBalanceHistoryChart = React.memo(BalanceHistoryChart);
......@@ -172,6 +173,16 @@ export default function BalanceHistory() {
message = "Showing Results with applied filters.";
}
// get the accountName
const routeAccountName = Array.isArray(router.query.accountName)
? router.query.accountName[0] // If it's an array, get the first element
: router.query.accountName; // Otherwise, treat it as a string directly
if(routeAccountName && !routeAccountName.startsWith("@") || !accountNameFromRoute)
{
return <ErrorPage />;
}
return (
<>
<Head>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment