This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {gql, useQuery} from '@apollo/client' | |
import {Grid} from "@material-ui/core"; | |
import {serverSideTranslations} from 'next-i18next/serverSideTranslations'; | |
import {addApolloState, initializeApollo} from '../apollo/client' | |
import {getDataFromTree} from "@apollo/client/react/ssr"; | |
export async function getServerSideProps(context) { | |
const client = initializeApollo({}) | |
// await getDataFromTree(SsrPage) (not working: see bug report) | |
const query1 = await client.query({query: ComplaintsQuery}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {ApolloProvider} from '@apollo/client' | |
import {useApollo} from '../apollo/client' | |
import {ThemeProvider} from '@material-ui/core/styles'; | |
import CssBaseline from '@material-ui/core/CssBaseline'; | |
import Head from 'next/head'; | |
import theme from '../components/theme'; | |
import PropTypes from 'prop-types'; | |
import {appWithTranslation} from 'next-i18next'; | |
import {Provider} from 'next-auth/client' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {useMemo} from 'react' | |
import {ApolloClient, gql} from '@apollo/client' | |
import merge from 'deepmerge' | |
import {cache} from './cache' | |
import {isSSR} from "../constants/util"; | |
import isEqual from 'lodash/isEqual' | |
export const APOLLO_STATE_PROP_NAME = '__APOLLO_STATE__' | |
const typeDefs = gql` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# GRAPHQL_SERVER_VERSION=$1 | |
# NEXT_SERVER_VERSION=$2 | |
# set variables from .env to system: https://gist.github.com/mihow/9c7f559807069a03e302605691f85572 | |
if [ -f .env ] | |
then | |
export $(cat .env | sed 's/#.*//g' | xargs) | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# syntax=docker/dockerfile:1 | |
# docker build . -t graphql:1.0.0 | |
# docker run -d --name graphql_server graphql:1.0.0 | |
# docker ps -a | |
# docker logs [name] | |
# docker exec -it [name] /bin/sh | |
# babel is under node_modules/.bin | |
# docker rm [name] //removes runtime conainer | |
# docker rm $(docker ps -a -q) //removes all stopped containers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# start: docker-compose up (-d for detached mode) | |
# stop: docker-compose down | |
version: "3.9" | |
services: | |
redis-server: | |
container_name: redis-server | |
image: 'redis:6.2-alpine' | |
networks: | |
- weally |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Instructions found in the following links | |
# https://docs.docker.com/engine/install/ubuntu/ | |
# https://docs.docker.com/engine/install/linux-postinstall/ | |
#: clean previous | |
sudo apt-get remove docker docker-engine docker.io containerd runc | |
#: install | |
sudo apt-get update | |
sudo apt-get install \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logger from '../../lib/logger' | |
import {getSession} from "next-auth/client"; | |
import dynamic from "next/dynamic"; | |
function isTrueStr(str) { | |
return str === true || | |
(str != null && | |
str.toString().toLowerCase() === 'true') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export async function getServerSideProps(context) { | |
const session = await getSession(context) | |
const client = initializeApollo({}) | |
//await getDataFromTree(Index) replaced by manual client.query calls | |
const cpl = await client.query({ | |
query: ComplaintsQuery, context: { | |
headers: {'infra-token': session?.infraToken} | |
} | |
}) | |
//... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {useMemo} from 'react' | |
import {ApolloClient, HttpLink, gql} from '@apollo/client' | |
import merge from 'deepmerge' | |
import {cache} from './cache' | |
import {isSSR} from "../constants/util"; | |
import isEqual from 'lodash/isEqual' | |
import logger from "../lib/logger"; | |
export const APOLLO_STATE_PROP_NAME = '__APOLLO_STATE__' |
OlderNewer