add prev and next to stored state
This commit is contained in:
parent
e553e9ff0b
commit
80415104e5
|
@ -12,7 +12,7 @@ import {
|
|||
} from '$lib/server/auth';
|
||||
import type {PageServerLoad} from './$types';
|
||||
|
||||
export const load: PageServerLoad = async ({cookies, params}) => {
|
||||
export const load: PageServerLoad = async ({cookies, params, url}) => {
|
||||
// figure out what auth provider the user wanted to try
|
||||
let provider: AuthProvider;
|
||||
if (params.provider === 'discord') {
|
||||
|
@ -27,7 +27,11 @@ export const load: PageServerLoad = async ({cookies, params}) => {
|
|||
|
||||
// store a state for this login attempt
|
||||
const authStatesRepo = await dataSource.getRepository(AuthState);
|
||||
const state = authStatesRepo.create({provider});
|
||||
const state = authStatesRepo.create({
|
||||
provider,
|
||||
prev: url.searchParams.get('prev') ?? '/',
|
||||
next: url.searchParams.get('next') ?? '/',
|
||||
});
|
||||
await authStatesRepo.save(state);
|
||||
|
||||
// set the state ID as a cookie so we can retrieve it later and compare
|
||||
|
|
Loading…
Reference in a new issue