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 type { Actions, PageServerLoad } from "./$types"
|
||||||
import { error } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ locals }) => {
|
|
||||||
return {
|
|
||||||
user: locals.user,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const actions: Actions = {
|
export const actions: Actions = {
|
||||||
login: async (event) => {
|
login: async (event) => {
|
||||||
const data = await event.request.formData()
|
const data = await event.request.formData()
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
import { redirect } from "@sveltejs/kit"
|
import { redirect } from "@sveltejs/kit"
|
||||||
import type { Actions, PageServerLoad } from "./$types"
|
import type { Actions, PageServerLoad } from "./$types"
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ locals }) => {
|
|
||||||
return {
|
|
||||||
user: locals.user,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const actions: Actions = {
|
export const actions: Actions = {
|
||||||
register: async (event) => {
|
register: async (event) => {
|
||||||
const data = await event.request.formData();
|
const data = await event.request.formData();
|
||||||
|
@ -2,10 +2,9 @@ import { redirect } from "@sveltejs/kit"
|
|||||||
import type { Actions, PageServerLoad } from "./$types"
|
import type { Actions, PageServerLoad } from "./$types"
|
||||||
import { error } from "@sveltejs/kit"
|
import { error } from "@sveltejs/kit"
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ locals }) => {
|
export const load: PageServerLoad = async ({ cookies }) => {
|
||||||
return {
|
const user = await authenticateUser(cookies)
|
||||||
user: locals.user,
|
return {user}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const actions: Actions = {
|
export const actions: Actions = {
|
||||||
|
Loading…
Reference in New Issue
Block a user