Skip to content

Instantly share code, notes, and snippets.

View richardherbert's full-sized avatar

Richard Herbert richardherbert

View GitHub Profile
@richardherbert
richardherbert / gist:9cbac5fbb1b7d63f8492c31be8c4a06e
Created January 13, 2026 14:35
src/routes/signout/+page.server.js
// src/routes/signout/+page.server.js
import { supabase } from '$lib/supabaseClient';
export const load = async () => {
const { error } = await supabase.auth.signOut();
}
@richardherbert
richardherbert / gist:9433542b07a14f213d221c9af49f79e7
Created January 13, 2026 14:34
src/routes/secure/players/+page.server.js
// src/routes/secure/players/+page.server.js
import { supabase } from '$lib/supabaseClient';
export const load = async ( { parent }) => {
await parent();
const { data } = await supabase.from( 'players' )
.select()
.order( 'givenName', { ascending: true } )
.order( 'familyName', { ascending: true } );
@richardherbert
richardherbert / gist:8119331ff3a6de683254bb6681e37d87
Created January 13, 2026 14:32
src/routes/secure/+layout.server.js
// src/routes/secure/+layout.server.js
import { supabase } from '$lib/supabaseClient';
import { redirect } from "@sveltejs/kit"
export const load = async () => {
const { data: { user } } = await supabase.auth.getUser();
if( !user ) {
redirect( 303, '/signin' );
}
@richardherbert
richardherbert / gist:f89f44066ca196d32ca0fbe58b0f2b77
Created January 13, 2026 14:31
src/routes/signin/+page.server.js
// src/routes/signin/+page.server.js
import { redirect } from '@sveltejs/kit';
import { supabase } from '$lib/supabaseClient';
export const actions = {
default: async ( { request } ) => {
const form = await request.formData();
const email = form.get( 'email' );
const password = form.get( 'password' );

Keybase proof

I hereby claim:

  • I am richardherbert on github.
  • I am richardherbert (https://keybase.io/richardherbert) on keybase.
  • I have a public key ASBTJb5NgRjEPrEAqRZVFDmiihvQ4e-0HM9INyCYCO_bFAo

To claim this, I am signing this object: