Skip to content

Commit

Permalink
(V3) Update docs to use SvelteKit 2 redirect (#1346)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustMrMendez authored Jan 20, 2024
1 parent b8c2506 commit 53bb746
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/pages/guides/validate-session-cookies/sveltekit.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import type { Actions, PageServerLoad } from "./$types";

export const load: PageServerLoad = async (event) => {
if (!event.locals.user) {
throw redirect("/login");
redirect("/login");
}
// ...
};
Expand Down
6 changes: 3 additions & 3 deletions docs/pages/tutorials/github-oauth/sveltekit.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export async function GET(event: RequestEvent): Promise<Response> {
sameSite: "lax"
});

return redirect(302, url.toString());
redirect(302, url.toString());
}
```

Expand Down Expand Up @@ -210,7 +210,7 @@ You can validate requests by checking `locals.user`. The field `user.username` i
import type { PageServerLoad, Actions } from "./$types";

export const load: PageServerLoad = async (event) => {
if (!event.locals.user) throw redirect(302, "/login");
if (!event.locals.user) redirect(302, "/login");
return {
username: event.locals.user.username
};
Expand Down Expand Up @@ -243,7 +243,7 @@ export const actions: Actions = {
path: ".",
...sessionCookie.attributes
});
return redirect(302, "/login");
redirect(302, "/login");
}
};
```
Expand Down
8 changes: 4 additions & 4 deletions docs/pages/tutorials/username-and-password/sveltekit.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const actions: Actions = {
...sessionCookie.attributes
});

return redirect(302, "/");
redirect(302, "/");
}
};
```
Expand Down Expand Up @@ -217,7 +217,7 @@ export const actions: Actions = {
...sessionCookie.attributes
});

return redirect(302, "/");
redirect(302, "/");
}
};
```
Expand All @@ -231,7 +231,7 @@ You can validate requests by checking `locals.user`. The field `user.username` i
import type { PageServerLoad, Actions } from "./$types";

export const load: PageServerLoad = async (event) => {
if (!event.locals.user) throw redirect(302, "/login");
if (!event.locals.user) redirect(302, "/login");
return {
username: event.locals.user.username
};
Expand Down Expand Up @@ -264,7 +264,7 @@ export const actions: Actions = {
path: ".",
...sessionCookie.attributes
});
return redirect(302, "/login");
redirect(302, "/login");
}
};
```
Expand Down

0 comments on commit 53bb746

Please sign in to comment.