1
- import { type LinksFunction , type MetaFunction } from '@remix-run/node'
1
+ import type { LoaderFunctionArgs } from '@remix-run/node'
2
+ import { redirect , type LinksFunction , type MetaFunction } from '@remix-run/node'
2
3
import {
3
4
ContactUs ,
4
5
CookieConsentBar ,
@@ -13,6 +14,7 @@ import stylesheet from '~/styles/next-tailwind.css'
13
14
import urlJoin from 'url-join'
14
15
import type { rootLoader } from '../root'
15
16
import React from 'react'
17
+ import { getUser } from '../util/api.server'
16
18
17
19
export const links : LinksFunction = ( ) => [
18
20
// css
@@ -56,7 +58,7 @@ export const meta: MetaFunction<typeof rootLoader> = ({ data }) => {
56
58
{ name : 'msapplication-TileColor' , content : '#da532c' } ,
57
59
{ name : 'theme-color' , content : '#ffffff' } ,
58
60
{ property : 'og:title' , content : 'Utopia: Design and Code on one platform' } ,
59
- { property : 'og:image' , content : urlJoin ( data ?. env . UTOPIA_CDN_URL ?? '' , '/og-card.png' ) } ,
61
+ { property : 'og:image' , content : urlJoin ( data ?. env ? .UTOPIA_CDN_URL ?? '' , '/og-card.png' ) } ,
60
62
{ property : 'og:type' , content : 'website' } ,
61
63
{
62
64
property : 'og:description' ,
@@ -66,6 +68,14 @@ export const meta: MetaFunction<typeof rootLoader> = ({ data }) => {
66
68
]
67
69
}
68
70
71
+ export async function loader ( args : LoaderFunctionArgs ) {
72
+ const user = await getUser ( args . request )
73
+ if ( user != null ) {
74
+ return redirect ( `/projects` )
75
+ }
76
+ return { }
77
+ }
78
+
69
79
const IndexPage = React . memo ( ( ) => {
70
80
return (
71
81
< div className = 'bg-white' >
0 commit comments