redirect away from create form if account has name

This commit is contained in:
Erin 2023-11-12 17:51:47 -05:00
parent 362ce60287
commit 8a1d245468

View file

@ -0,0 +1,10 @@
import {redirect} from '@sveltejs/kit';
import type {PageLoad} from './$types';
export const load: PageLoad = async ({parent, url}) => {
// the user has already done initial setup - go back to the normal profile
const parentData = await parent();
if (parentData.user && parentData.user.name) {
throw redirect(302, '/profile');
}
};