Skip to content

Instantly share code, notes, and snippets.

@richardherbert
Created January 13, 2026 14:32
Show Gist options
  • Select an option

  • Save richardherbert/8119331ff3a6de683254bb6681e37d87 to your computer and use it in GitHub Desktop.

Select an option

Save richardherbert/8119331ff3a6de683254bb6681e37d87 to your computer and use it in GitHub Desktop.
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' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment