Skip to content

Commit 6c73566

Browse files
committed
fix: handle non-integer templateId by removing it from search params and reloading the page
1 parent cb6d36f commit 6c73566

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/pages/JoinPage/useJoinSubmit.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ export function useJoinSubmit(isInvited: boolean) {
2121
if (templateParam !== null) {
2222
const parsed = Number(templateParam);
2323
if (!Number.isInteger(parsed)) {
24-
throw new Error('Template must be an integer');
24+
searchParams.delete('template');
25+
const url = window.location.origin + window.location.pathname;
26+
window.history.replaceState({}, '', url);
27+
window.location.reload();
2528
}
2629
templateId = parsed;
2730
}

0 commit comments

Comments
 (0)