mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Merge branch 'main' of github.com:stackframe-projects/stack
This commit is contained in:
commit
5dcc831f96
@ -342,7 +342,12 @@ export function redirectHandler(redirectPath: string, statusCode: 301 | 302 | 30
|
||||
body: yup.string().required(),
|
||||
}),
|
||||
async handler(req) {
|
||||
const newUrl = new URL(redirectPath, req.url + "/");
|
||||
const urlWithTrailingSlash = new URL(req.url);
|
||||
if (!urlWithTrailingSlash.pathname.endsWith("/")) {
|
||||
urlWithTrailingSlash.pathname += "/";
|
||||
}
|
||||
const newUrl = new URL(redirectPath, urlWithTrailingSlash);
|
||||
console.log({ req, newUrl });
|
||||
return {
|
||||
statusCode,
|
||||
headers: {
|
||||
|
||||
@ -4,6 +4,7 @@ import { useRouter } from "next/navigation";
|
||||
import { useStackApp } from "..";
|
||||
import MessageCard from "./message-card";
|
||||
import { Text, Button } from "../components-core";
|
||||
import { neverResolve } from "@stackframe/stack-shared/dist/utils/promises";
|
||||
|
||||
export default function RedirectMessageCard({
|
||||
type,
|
||||
@ -67,13 +68,19 @@ export default function RedirectMessageCard({
|
||||
{secondaryButton && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => router.push(stackApp.urls.signOut.toString())}
|
||||
onClick={async () => {
|
||||
router.push(stackApp.urls.signOut.toString());
|
||||
await neverResolve();
|
||||
}}
|
||||
>
|
||||
{secondaryButton}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
<Button onClick={() => router.push(primaryUrl.toString())}>
|
||||
<Button onClick={async () => {
|
||||
router.push(primaryUrl.toString());
|
||||
await neverResolve();
|
||||
}}>
|
||||
{primaryButton}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user