changes to work with SvelteKit v1.0.0-next.278#2
Merged
JannikWempe merged 1 commit intoJannikWempe:masterfrom Feb 21, 2022
Merged
changes to work with SvelteKit v1.0.0-next.278#2JannikWempe merged 1 commit intoJannikWempe:masterfrom
JannikWempe merged 1 commit intoJannikWempe:masterfrom
Conversation
|
Great! |
|
Change sign-ou.js to the following: export async function get ({ request }) {
const cookie = await request.headers.cookie;
const cookies = parse(cookie || '');
... |
|
Opps. It's my bad. You already had it. Sorry. |
Owner
|
Thanks for the PR. I'll check it later. |
When you do, you could also have a look at shadow endpoints, meaning instead of using the
export async function get({ locals }) {
// do your checks here on condition of availability of locals.user
console.log(locals);
if (locals.user) {
return {
status: 200,
body: {
locals
}
};
} else {
return {
status: 302,
headers: { Location: '/' }
};
}
}Here is a simple little demo. https://github.com/robots4life/cookie-auth |
Owner
|
@robots4life thanks for pointing that out. For now, I'll stick with the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While following your tutorial on logrocket.com and trying to replicate the app I had to make some adjustments due to breaking changes introduced in sveltejs/kit (sveltejs/kit#3384)
Btw great tutorial, very helpful and exactly what I needed for my app.