Skip to content

Commit

Permalink
fix: updates based on pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
brettski committed Oct 17, 2023
1 parent e86a88e commit e46da2b
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
// This file ensures hooks.server.js is run whenever this route is accessed
/* This empty page is intentional
* having this +page.server page here forces the hooks.server handler to execute
* regardless if page.svelte is fully loaded or not
* https://github.com/sveltejs/kit/issues/6315
*/
Empty file.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { redirect } from '@sveltejs/kit';
import { redirect, error } from '@sveltejs/kit';
import * as Sentry from '@sentry/sveltekit';

export async function load({ fetch, locals, url }) {
export async function GET({ fetch, locals, url }) {
const returnTo = url.searchParams?.get('returnTo') || '/';
let _url = '';
let _url = '/';
try {
const session = await locals.getSession();
if (!session?.user) {
Expand Down Expand Up @@ -30,7 +31,8 @@ export async function load({ fetch, locals, url }) {
}
}
} catch (err) {
console.error(err);
Sentry.setContext('error', { err });
throw error(500, 'Authentication Login Error');
}

if (_url) {
Expand Down
12 changes: 0 additions & 12 deletions src/routes/(root)/logout/+page.svelte

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { redirect } from '@sveltejs/kit';
import { redirect, error } from '@sveltejs/kit';
import * as Sentry from '@sentry/sveltekit';

export async function load({ fetch, locals, url }) {
let _url = '';
export async function GET({ fetch, locals, url }) {
let _url = '/';
try {
const session = await locals.getSession();

Expand Down Expand Up @@ -30,7 +31,8 @@ export async function load({ fetch, locals, url }) {
}
}
} catch (err) {
console.error('Error during logout:', err);
Sentry.setContext('error', { err });
throw error(500, 'Authentication Logout Error');
}

if (_url) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { redirect } from '@sveltejs/kit';
import { redirect, error } from '@sveltejs/kit';
import * as Sentry from '@sentry/sveltekit';

export async function load({ fetch, locals }) {
let _url = '';
export async function GET({ fetch, locals }) {
let _url = '/';
try {
const session = await locals.getSession();
if (!session?.user) {
Expand Down Expand Up @@ -32,7 +33,8 @@ export async function load({ fetch, locals }) {
}
}
} catch (err) {
console.error(err);
Sentry.setContext('error', { err });
throw error(500, 'Authentication Sign-up Error');
}

if (_url) {
Expand Down
5 changes: 4 additions & 1 deletion src/routes/(root)/speakers/+layout.server.js
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
// pages forces hooks.server.js to execute when page is fully hydrated and loaded
/* This empty page is intentional
* having this +layout.server page here forces the hooks.server handler to execute
* https://github.com/sveltejs/kit/issues/6315
*/

0 comments on commit e46da2b

Please sign in to comment.