File tree Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change 1
1
import { headers } from 'next/headers'
2
+ import Layout from 'src/components/Layout'
3
+ import Login from 'src/components/Login'
2
4
import loadSerializableQuery from 'src/relay/loadSerializableQuery'
3
5
import MainViewQueryNode , { HomeQuery } from '__generated__/HomeQuery.graphql'
4
6
import HomePage from './Home'
5
7
6
8
const Page = async ( ) => {
7
9
const requestCookie = headers ( ) . get ( 'cookie' )
8
- const preloadedQuery = await loadSerializableQuery <
9
- typeof MainViewQueryNode ,
10
- HomeQuery
11
- > ( MainViewQueryNode . params , { } , requestCookie ?? '' )
10
+ try {
11
+ const preloadedQuery = await loadSerializableQuery <
12
+ typeof MainViewQueryNode ,
13
+ HomeQuery
14
+ > ( MainViewQueryNode . params , { } , requestCookie ?? '' )
12
15
13
- return (
14
- < div >
15
- < HomePage preloadedQuery = { preloadedQuery } cookies = { requestCookie ?? '' } />
16
- </ div >
17
- )
16
+ return (
17
+ < div >
18
+ < HomePage
19
+ preloadedQuery = { preloadedQuery }
20
+ cookies = { requestCookie ?? '' }
21
+ />
22
+ </ div >
23
+ )
24
+ } catch ( e ) {
25
+ if ( ( e as Error ) ?. message . includes ( 'Unauthorized' ) ) {
26
+ return < Layout sidebarContentLeft = { < Login /> } > Feed goes here.</ Layout >
27
+ }
28
+ }
18
29
}
19
30
20
31
export default Page
You can’t perform that action at this time.
0 commit comments