Skip to content

Commit f811425

Browse files
committed
remove hash from url
1 parent 25dbc97 commit f811425

File tree

3 files changed

+2
-35
lines changed

3 files changed

+2
-35
lines changed

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

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ import { SecretKeyInputComponent } from "@/features/decoder/components/secret-ke
88
import { useDecoderStore } from "@/features/decoder/services/decoder.store";
99
import { useRouter } from "next/navigation";
1010
import {
11-
SupportedTokenHashParamValues,
12-
WARNING_PARAM_KEY,
13-
WARNING_PARAM_VALUE,
11+
SupportedTokenHashParamValues
1412
} from "@/libs/config/project.constants";
1513
import { HomeDictionaryModel } from "@/features/localization/models/home-dictionary.model";
1614
import { ClaimDescriptionVisibilityValues } from "@/features/common/values/claim-description-visibility.values";
@@ -90,36 +88,9 @@ export const TokenDecoderComponent: React.FC<TokenDecoderComponentProps> = ({
9088
});
9189
};
9290

93-
const handleWarning = () => {
94-
const search = window.location.search;
95-
96-
const searchParams = new URLSearchParams(search);
97-
const warning = searchParams.get(WARNING_PARAM_KEY);
98-
99-
if (warning === WARNING_PARAM_VALUE) {
100-
101-
searchParams.delete(WARNING_PARAM_KEY);
102-
103-
const currentUrl = window.location.href.split("?")[0];
104-
105-
let newUrl = `${currentUrl}`;
106-
107-
if (searchParams.size > 0) {
108-
newUrl += `?${searchParams.toString()}`;
109-
}
110-
111-
if (window.location.hash) {
112-
newUrl += window.location.hash;
113-
}
114-
115-
router.push(newUrl);
116-
}
117-
};
118-
11991
window.addEventListener("hashchange", handleHashChange);
120-
92+
12193
handleHashChange();
122-
handleWarning();
12394

12495
return () => {
12596
window.removeEventListener("hashchange", handleHashChange);

src/libs/config/project.constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ export enum SupportedTokenHashParamValues {
1010
ID_TOKEN = "id_token",
1111
VALUE = "value",
1212
}
13-
export const WARNING_PARAM_KEY = "warning";
14-
export const WARNING_PARAM_VALUE = "use_hash";
1513

1614
export const EBOOK_URL =
1715
"https://auth0.com/resources/ebooks/jwt-handbook/?utm_source=jwtio&utm_medium=banner&utm_campaign=jwt-handbook";

src/middleware.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ export function middleware(request: NextRequest) {
4848
request.nextUrl.searchParams.delete("access_token");
4949
request.nextUrl.searchParams.delete("value");
5050

51-
request.nextUrl.searchParams.append("warning", "use_hash");
52-
5351
request.nextUrl.hash = `token=${tokenParam}`;
5452

5553
return NextResponse.redirect(request.nextUrl);

0 commit comments

Comments
 (0)