Skip to content

Commit 33f1fb5

Browse files
committed
update auth gaurd
1 parent 4607251 commit 33f1fb5

2 files changed

Lines changed: 15 additions & 16 deletions

File tree

src/frontend/src/components/authorization/authGuard/index.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,14 @@ export const ProtectedRoute = ({ children }) => {
3838
const isRootPage = currentPath === "/";
3939
const isFlowsPage = currentPath.includes("/flows");
4040
const isPricingPage = currentPath.includes("/pricing");
41+
const pricingBypassSearch = new URLSearchParams(currentSearch);
4142
const hasPricingBypassParam =
42-
new URLSearchParams(currentSearch).get("pricing_bypass") === "1";
43+
pricingBypassSearch.get("pricing_bypass") === "1" ||
44+
pricingBypassSearch.get("pricingBypass") === "1";
4345
const hasPricingBypassSession =
4446
sessionStorage.getItem("pricingBypass") === "1";
4547
const isPricingBypass =
46-
isFlowsPage &&
47-
(hasPricingBypassParam || hasPricingBypassSession) &&
48-
isSignedIn === true &&
49-
isOrgSelected;
48+
isFlowsPage && (hasPricingBypassParam || hasPricingBypassSession);
5049

5150
// 🔹 Billing state
5251
const [hasAccess, setHasAccess] = useState<boolean | null>(null);
@@ -146,16 +145,17 @@ export const ProtectedRoute = ({ children }) => {
146145
return null;
147146
}
148147

149-
if (isSignedIn && !isOrgSelected) {
150-
return <CustomNavigate to="/organization" replace />;
151-
}
152-
153148
if (isPricingBypass) {
154149
// Temporary bypass from pricing placeholder until checkout is implemented
155-
} else if (isSignedIn && hasAccess === null) {
156-
return null;
157-
}
150+
} else {
151+
if (isSignedIn && !isOrgSelected) {
152+
return <CustomNavigate to="/organization" replace />;
153+
}
158154

155+
if (isSignedIn && hasAccess === null) {
156+
return null;
157+
}
158+
}
159159
if (isCheckingAccess) {
160160
return null;
161161
}

src/frontend/src/pages/PricingPage/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,14 @@ export default function PricingPage() {
266266
</div>
267267

268268
<div className="mt-8 flex justify-center">
269-
<button
269+
<button
270270
type="button"
271271
onClick={() => {
272-
sessionStorage.setItem("pricingBypass", "1");
273-
navigate("/flows");
272+
navigate("/flows?pricingBypass=1");
274273
}}
275274
className="mr-3 rounded-lg border border-cyan-300/40 px-4 py-2 text-sm"
276275
>
277-
Temporary: Go to flows
276+
Go to flows
278277
</button>
279278
<button
280279
type="button"

0 commit comments

Comments
 (0)