Skip to content

Commit

Permalink
Add direct registration link
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed Aug 5, 2024
1 parent eb1bd2d commit 8a7cfea
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 3 deletions.
21 changes: 20 additions & 1 deletion examples/react-router/src/router/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,26 @@ export function Header() {
</div>
) : (
<div>
<button onClick={() => login({ doesCurrentHrefRequiresAuth: false })}>Login</button>
<button onClick={() => login({ doesCurrentHrefRequiresAuth: false })}>Login</button>{" "}
<button
onClick={() =>
login({
doesCurrentHrefRequiresAuth: false,
transformUrlBeforeRedirect: url => {
const urlObj = new URL(url);

urlObj.pathname = urlObj.pathname.replace(
/\/auth$/,
"/registrations"
);

return urlObj.href;
}
})
}
>
Register
</button>
</div>
)}
</div>
Expand Down
21 changes: 20 additions & 1 deletion examples/tanstack-router-file-based/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,26 @@ export function Header() {
</div>
) : (
<div>
<button onClick={() => login({ doesCurrentHrefRequiresAuth: false })}>Login</button>
<button onClick={() => login({ doesCurrentHrefRequiresAuth: false })}>Login</button>{" "}
<button
onClick={() =>
login({
doesCurrentHrefRequiresAuth: false,
transformUrlBeforeRedirect: url => {
const urlObj = new URL(url);

urlObj.pathname = urlObj.pathname.replace(
/\/auth$/,
"/registrations"
);

return urlObj.href;
}
})
}
>
Register
</button>
</div>
)}
</div>
Expand Down
21 changes: 20 additions & 1 deletion examples/tanstack-router/src/router/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,26 @@ export function Header() {
</div>
) : (
<div>
<button onClick={() => login({ doesCurrentHrefRequiresAuth: false })}>Login</button>
<button onClick={() => login({ doesCurrentHrefRequiresAuth: false })}>Login</button>{" "}
<button
onClick={() =>
login({
doesCurrentHrefRequiresAuth: false,
transformUrlBeforeRedirect: url => {
const urlObj = new URL(url);

urlObj.pathname = urlObj.pathname.replace(
/\/auth$/,
"/registrations"
);

return urlObj.href;
}
})
}
>
Register
</button>
</div>
)}
</div>
Expand Down

0 comments on commit 8a7cfea

Please sign in to comment.