Add redirect to layout's load
This commit is contained in:
@@ -65,10 +65,7 @@
|
||||
label="Login"
|
||||
variant={VARIANTS.OUTLINED}
|
||||
className="mx-2"
|
||||
onClick={() => {
|
||||
console.log('clicked login');
|
||||
goto('/login' + redirect);
|
||||
}}
|
||||
onClick={() => goto('/login' + redirect)}
|
||||
/>
|
||||
<PrimaryButton
|
||||
label="Sign Up"
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
|
||||
export const load = ({ url }) => {
|
||||
console.log('url', url.hostname);
|
||||
|
||||
if (url.hostname === 'classroomio.com' || url.hostname === 'classroomio.netlify.app') {
|
||||
throw redirect(301, 'https://about.classroomio.com');
|
||||
}
|
||||
};
|
||||
@@ -1,11 +0,0 @@
|
||||
import type { Handle } from '@sveltejs/kit';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
|
||||
export const handle = (async ({ event, resolve }) => {
|
||||
if (event.url.host === 'classroomio.com') {
|
||||
throw redirect(307, 'https://about.classroomio.com');
|
||||
}
|
||||
|
||||
const response = await resolve(event);
|
||||
return response;
|
||||
}) satisfies Handle;
|
||||
Reference in New Issue
Block a user