Skip to content

Commit 4ef07df

Browse files
authored
revert back from SSR to SSG (#1578)
1 parent d48dc6b commit 4ef07df

File tree

1 file changed

+3
-41
lines changed

1 file changed

+3
-41
lines changed

src/templates/schedule.tsx

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,9 @@ import ScheduleList, {
88
ScheduleSession,
99
} from "../components/Conf/Schedule/ScheduleList"
1010

11-
const fetchData = async (url: string) => {
12-
try {
13-
const response = await fetch(url, {
14-
method: "POST",
15-
headers: {
16-
"Content-Type": "application/json",
17-
"User-Agent": "GraphQL Conf / GraphQL Foundation",
18-
},
19-
})
20-
const data = await response.json()
21-
return data
22-
} catch (error: any) {
23-
throw new Error(
24-
`Error fetching data from ${url}: ${error.message || error.toString()}`
25-
)
26-
}
27-
}
28-
29-
export async function getServerData() {
30-
try {
31-
const schedule: ScheduleSession[] = await fetchData(
32-
`https://graphqlconf23.sched.com/api/session/list?api_key=${process.env.SCHED_ACCESS_TOKEN}&format=json`
33-
)
34-
35-
return {
36-
props: {
37-
schedule,
38-
},
39-
}
40-
} catch (error) {
41-
return {
42-
status: 500,
43-
headers: {},
44-
props: {},
45-
}
46-
}
47-
}
48-
49-
const ScheduleTemplate: FC<
50-
PageProps<{}, {}, {}, { schedule: ScheduleSession[] }>
51-
> = ({ serverData: { schedule } }) => {
11+
const ScheduleTemplate: FC<PageProps<{}, { schedule: ScheduleSession[] }>> = ({
12+
pageContext: { schedule },
13+
}) => {
5214
return (
5315
<LayoutConf>
5416
<HeaderConf className="shadow-none" />

0 commit comments

Comments
 (0)