forked from ballonsballons-at/ballons-jaen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-ssr.tsx
35 lines (30 loc) · 911 Bytes
/
gatsby-ssr.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Implement Gatsby's SSR (Server Side Rendering) APIs in this file.
*
* See: https://www.gatsbyjs.com/docs/ssr-apis/
*/
import { GatsbySSR } from "gatsby"
import { AuthenticationProvider } from "./src/services/authentication"
import { RootWrapper } from "./src/Wrapper"
export const onRenderBody: GatsbySSR["onRenderBody"] = ({
setHtmlAttributes,
setHeadComponents
}) => {
setHtmlAttributes({ lang: `de` })
setHeadComponents([
<link
key="red-buttery"
rel="preload"
href="/fonts/red_buttery-webfont.woff2"
as="font"
type="font/woff2"
crossOrigin="anonymous"
/>
]);
}
export const wrapRootElement: GatsbySSR["wrapRootElement"] = ({ element }) => {
return <RootWrapper>{element}</RootWrapper>
}
export const wrapPageElement: GatsbySSR["wrapPageElement"] = ({ element }) => {
return <AuthenticationProvider>{element}</AuthenticationProvider>
}