get user from cookie, not locals
This commit is contained in:
parent
8ebc407752
commit
41f42eb2b4
@ -2,12 +2,6 @@ import { redirect } from "@sveltejs/kit"
|
||||
import type { Actions, PageServerLoad } from "./$types"
|
||||
import { error } from "@sveltejs/kit"
|
||||
|
||||
export const load: PageServerLoad = async ({ locals }) => {
|
||||
return {
|
||||
user: locals.user,
|
||||
}
|
||||
}
|
||||
|
||||
export const actions: Actions = {
|
||||
login: async (event) => {
|
||||
const data = await event.request.formData()
|
||||
|
@ -1,12 +1,6 @@
|
||||
import { redirect } from "@sveltejs/kit"
|
||||
import type { Actions, PageServerLoad } from "./$types"
|
||||
|
||||
export const load: PageServerLoad = async ({ locals }) => {
|
||||
return {
|
||||
user: locals.user,
|
||||
}
|
||||
}
|
||||
|
||||
export const actions: Actions = {
|
||||
register: async (event) => {
|
||||
const data = await event.request.formData();
|
||||
|
@ -2,10 +2,9 @@ import { redirect } from "@sveltejs/kit"
|
||||
import type { Actions, PageServerLoad } from "./$types"
|
||||
import { error } from "@sveltejs/kit"
|
||||
|
||||
export const load: PageServerLoad = async ({ locals }) => {
|
||||
return {
|
||||
user: locals.user,
|
||||
}
|
||||
export const load: PageServerLoad = async ({ cookies }) => {
|
||||
const user = await authenticateUser(cookies)
|
||||
return {user}
|
||||
}
|
||||
|
||||
export const actions: Actions = {
|
||||
|
Loading…
Reference in New Issue
Block a user