Skip to content

Commit

Permalink
Merge pull request #126 from sqrl-planner/develop
Browse files Browse the repository at this point in the history
Bump version
  • Loading branch information
eamonma authored Apr 10, 2023
2 parents 1d9497e + 59e8e90 commit 17b62d0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
15 changes: 2 additions & 13 deletions pages/timetable/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { ApolloClient, InMemoryCache } from "@apollo/client"
import type { NextPage } from "next"
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
import React from "react"
import Layout from "../../components/Layout"
import TitleMeta from "../../components/TitleMeta"
import { GET_TIMETABLE_BY_ID } from "../../operations/queries/getTimetableById"
import { apolloClientParams } from "../../src/apollo-client"
import { PreferencesProvider } from "../../src/PreferencesContext"
import Sqrl from "../../src/Sqrl"
import { AppContextProvider } from "../../src/SqrlContext"
import { SectionsProvider } from "../../src/useSections"
import useSharePrefix from "../../src/useSharePrefix"

import { serverClient as serverSideApolloClient } from "../../src/apollo-client"

export const TimetableView: NextPage = (props: any) => {
const [sharePrefix] = useSharePrefix()

Expand Down Expand Up @@ -50,17 +50,6 @@ export async function getServerSideProps({

const id = query.id

const serverSideApolloClient = new ApolloClient({
ssrMode: true,
...apolloClientParams,
cache: new InMemoryCache(),
defaultOptions: {
query: {
fetchPolicy: "no-cache",
},
},
})

try {
const { data } = await serverSideApolloClient.query({
query: GET_TIMETABLE_BY_ID,
Expand Down
13 changes: 13 additions & 0 deletions src/apollo-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,17 @@ export const apolloClientParams = {
// https://dev.to/tmaximini/accessing-authorization-headers-in-apollo-graphql-client-3b50
const client = new ApolloClient(apolloClientParams)

const serverClient = new ApolloClient({
ssrMode: true,
...apolloClientParams,
cache: new InMemoryCache(),
defaultOptions: {
query: {
fetchPolicy: "no-cache",
},
},
})

export { serverClient }

export default client

0 comments on commit 17b62d0

Please sign in to comment.