-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A way to get the user object in +server.ts via the POST method #49
Comments
Make a PR bro |
When this PR gets merged, you can do it like this: import { redirect } from '@sveltejs/kit'
import { clerkClient } from 'svelte-clerk/server'
export const load = ({ locals }) => {
if (!locals.auth.userId) {
return redirect(307, '/sign-in')
}
const user = await clerkClient.users.getUser(userId)
return {
user: JSON.parse(JSON.stringify(user)),
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be really great if the user object was available inside the POST function of +server.ts
currently
event.locals
does not contain anything.Is there any for me to do this or for you to add this?
The text was updated successfully, but these errors were encountered: