Skip to content

Commit 26465fe

Browse files
committed
remove temp logs
1 parent ab7d9e0 commit 26465fe

File tree

2 files changed

+16
-31
lines changed

2 files changed

+16
-31
lines changed

src/features/decoder/components/token-decoder.component.tsx

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import { DecodedPayloadOutputComponent } from "@/features/decoder/components/dec
66
import { JwtInputComponent } from "@/features/decoder/components/jwt-input.component";
77
import { SecretKeyInputComponent } from "@/features/decoder/components/secret-key-input.component";
88
import { useDecoderStore } from "@/features/decoder/services/decoder.store";
9-
import { usePathname, useRouter, useSearchParams } from "next/navigation";
10-
import { SupportedTokenHashParamValues } from "@/libs/config/project.constants";
9+
import { useRouter } from "next/navigation";
10+
import {
11+
SupportedTokenHashParamValues
12+
} from "@/libs/config/project.constants";
1113
import { HomeDictionaryModel } from "@/features/localization/models/home-dictionary.model";
1214
import { ClaimDescriptionVisibilityValues } from "@/features/common/values/claim-description-visibility.values";
1315
import { useDebuggerStore } from "@/features/debugger/services/debugger.store";
@@ -39,8 +41,6 @@ export const TokenDecoderComponent: React.FC<TokenDecoderComponentProps> = ({
3941
headlineConfig,
4042
}) => {
4143
const isMounted = useRef(false);
42-
const searchParams = useSearchParams();
43-
const pathname = usePathname();
4444

4545
const router = useRouter();
4646

@@ -51,25 +51,8 @@ export const TokenDecoderComponent: React.FC<TokenDecoderComponentProps> = ({
5151

5252
useEffect(() => {
5353
const handleHashChange = () => {
54-
const tokenParam =
55-
searchParams.get("token") ||
56-
searchParams.get("id_token") ||
57-
searchParams.get("access_token") ||
58-
searchParams.get("value");
59-
const isHomePage = pathname === "/";
60-
const hash = tokenParam
61-
? `token=${tokenParam}`
62-
: window.location.hash.substring(1);
63-
64-
if (tokenParam && isHomePage) {
65-
const currentParams = new URLSearchParams(searchParams.toString());
66-
currentParams.delete("token");
67-
currentParams.delete("id_token");
68-
currentParams.delete("access_token");
69-
currentParams.delete("value");
70-
router.replace(`${pathname}#${hash}`);
71-
}
72-
console.count("hash handler fired");
54+
console.count("hash handler fired")
55+
const hash = window.location.hash.substring(1);
7356

7457
if (hash.includes("debugger-io?token=")) {
7558
const debugHash = window.location.hash
@@ -85,32 +68,34 @@ export const TokenDecoderComponent: React.FC<TokenDecoderComponentProps> = ({
8568
}
8669

8770
const newUrl = `${currentUrl}#${SupportedTokenHashParamValues.TOKEN}=${token}`;
88-
console.log("Logging hash length before replacing///", token.length);
71+
console.log("Logging hash length before replacing///", token.length)
8972
window.location.replace(newUrl);
9073

9174
return;
9275
}
9376

9477
if (!hash.includes("=")) {
95-
console.log("hash not includes =");
78+
console.log("hash not includes =")
9679
return;
9780
}
9881

82+
83+
9984
const hashParams = new URLSearchParams(hash);
100-
console.log("Hash param keys!!!", hashParams);
85+
console.log("Hash param keys!!!", hashParams)
10186
Object.values(SupportedTokenHashParamValues).forEach((hashParamKey) => {
10287
const token = hashParams.get(hashParamKey);
10388

10489
if (token) {
105-
console.count("handling jwt change");
106-
console.log("The token is:///", token);
90+
console.count("handling jwt change")
91+
console.log("The token is:///", token)
10792
handleJwtChange$(token);
10893
}
10994
});
11095
};
11196

11297
window.addEventListener("hashchange", handleHashChange);
113-
98+
11499
handleHashChange();
115100

116101
return () => {

src/middleware.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function middleware(request: NextRequest) {
3535
return;
3636
}
3737

38-
/* const tokenParam =
38+
const tokenParam =
3939
request.nextUrl.searchParams.get("token") ||
4040
request.nextUrl.searchParams.get("id_token") ||
4141
request.nextUrl.searchParams.get("access_token") ||
@@ -51,7 +51,7 @@ export function middleware(request: NextRequest) {
5151
request.nextUrl.hash = `token=${tokenParam}`;
5252

5353
return NextResponse.redirect(request.nextUrl);
54-
} */
54+
}
5555

5656
const libraryFilter = request.nextUrl.searchParams.get("language");
5757
const isLibrariesPage = pathname === "/libraries";

0 commit comments

Comments
 (0)