Commit 18dc1f66 authored by Willian Justen's avatar Willian Justen Committed by GitHub

Remove `isomorphic-unfetch` from examples (#12948)

Since 9.4 release, fetch is pollyfilled by default from #12353,
so the import is not needed anymore.
parent 4d0578bf
import { useState, useEffect } from 'react'
import fetch from 'isomorphic-unfetch'
export async function fetchUser(cookie = '') {
if (typeof window !== 'undefined' && window.__user) {
......
......@@ -10,7 +10,6 @@
"dependencies": {
"@auth0/nextjs-auth0": "^0.6.0",
"dotenv": "^8.2.0",
"isomorphic-unfetch": "^3.0.0",
"next": "latest",
"react": "^16.12.0",
"react-dom": "^16.12.0"
......
......@@ -10,7 +10,6 @@
"classnames": "2.2.6",
"date-fns": "2.10.0",
"gray-matter": "4.0.2",
"isomorphic-unfetch": "3.0.0",
"next": "latest",
"react": "^16.13.0",
"react-dom": "^16.13.0",
......
import 'isomorphic-unfetch'
const API_URL = 'https://graphql.datocms.com'
const API_TOKEN = process.env.NEXT_EXAMPLE_CMS_DATOCMS_API_TOKEN
......
......@@ -9,7 +9,6 @@
"dependencies": {
"classnames": "2.2.6",
"date-fns": "2.10.0",
"isomorphic-unfetch": "3.0.0",
"next": "latest",
"react": "^16.13.0",
"react-datocms": "1.1.0",
......
import 'isomorphic-unfetch'
import Prismic from 'prismic-javascript'
const REPOSITORY = process.env.NEXT_EXAMPLE_CMS_PRISMIC_REPOSITORY_NAME
......
......@@ -9,7 +9,6 @@
"dependencies": {
"classnames": "2.2.6",
"date-fns": "2.10.0",
"isomorphic-unfetch": "3.0.0",
"next": "9.2.3-canary.26",
"prismic-javascript": "2.2.0",
"prismic-reactjs": "1.2.0",
......
import fetch from 'isomorphic-unfetch'
const API_URL = `https://api.takeshape.io/project/${process.env.NEXT_EXAMPLE_CMS_TAKESHAPE_PROJECT_ID}/graphql`
const API_KEY = process.env.NEXT_EXAMPLE_CMS_TAKESHAPE_API_KEY
......
......@@ -9,7 +9,6 @@
"dependencies": {
"classnames": "2.2.6",
"date-fns": "2.10.0",
"isomorphic-unfetch": "3.0.0",
"next": "latest",
"react": "^16.13.0",
"react-dom": "^16.13.0",
......
......@@ -5,7 +5,6 @@
"dependencies": {
"actionhero": "^18.1.2",
"ioredis": "^3.2.2",
"isomorphic-fetch": "^2.2.1",
"next": "latest",
"react": "^16.7.0",
"react-dom": "^16.7.0",
......
......@@ -4,7 +4,6 @@ import { ApolloProvider } from '@apollo/react-hooks'
import { ApolloClient } from 'apollo-client'
import { InMemoryCache } from 'apollo-cache-inmemory'
import { HttpLink } from 'apollo-link-http'
import fetch from 'isomorphic-unfetch'
let globalApolloClient = null
......@@ -130,7 +129,6 @@ function createApolloClient(initialState = {}) {
link: new HttpLink({
uri: 'https://api.graph.cool/simple/v1/cixmkt2ul01q00122mksg82pn', // Server URL (must be absolute)
credentials: 'same-origin', // Additional fetch() options like `credentials` or `headers`
fetch,
}),
cache: new InMemoryCache().restore(initialState),
})
......
......@@ -14,7 +14,6 @@
"apollo-link-http": "1.5.16",
"graphql": "14.5.8",
"graphql-tag": "2.10.1",
"isomorphic-unfetch": "^3.0.0",
"next": "latest",
"prop-types": "^15.6.0",
"react": "^16.11.0",
......
import { ApolloClient } from 'apollo-client'
import { InMemoryCache } from 'apollo-cache-inmemory'
import { HttpLink } from 'apollo-link-http'
import fetch from 'isomorphic-unfetch'
export default function createApolloClient(initialState, ctx) {
// The `ctx` (NextPageContext) will only be present on the server.
......@@ -11,7 +10,6 @@ export default function createApolloClient(initialState, ctx) {
link: new HttpLink({
uri: 'https://api.graph.cool/simple/v1/cixmkt2ul01q00122mksg82pn', // Server URL (must be absolute)
credentials: 'same-origin', // Additional fetch() options like `credentials` or `headers`
fetch,
}),
cache: new InMemoryCache().restore(initialState),
})
......
......@@ -14,7 +14,6 @@
"apollo-link-http": "1.5.16",
"graphql": "^14.0.2",
"graphql-tag": "2.10.3",
"isomorphic-unfetch": "^3.0.0",
"next": "latest",
"prop-types": "^15.6.2",
"react": "^16.7.0",
......
......@@ -14,8 +14,5 @@
"react": "^16.7.0",
"react-dom": "^16.7.0"
},
"devDependencies": {
"isomorphic-unfetch": "^3.0.0"
},
"license": "ISC"
}
......@@ -10,7 +10,6 @@
"cookie-session": "1.4.0",
"firebase": "^7.6.1",
"firebase-admin": "^8.9.0",
"isomorphic-unfetch": "^3.0.0",
"lodash": "4.17.15",
"next": "latest",
"prop-types": "15.7.2",
......
// From:
// https://github.com/zeit/next.js/blob/canary/examples/with-firebase-authentication/pages/index.js
import fetch from 'isomorphic-unfetch'
export const setSession = user => {
// Log in.
if (user) {
......
import { GraphQLClient } from 'graphql-hooks'
import memCache from 'graphql-hooks-memcache'
import unfetch from 'isomorphic-unfetch'
let graphQLClient = null
......@@ -9,7 +8,6 @@ function create(initialState = {}) {
ssrMode: typeof window === 'undefined',
url: 'https://api.graph.cool/simple/v1/cixmkt2ul01q00122mksg82pn',
cache: memCache({ initialState }),
fetch: typeof window !== 'undefined' ? fetch.bind() : unfetch, // eslint-disable-line
})
}
......
......@@ -14,7 +14,6 @@
"graphql-hooks": "^3.2.1",
"graphql-hooks-memcache": "^1.0.4",
"graphql-hooks-ssr": "^1.0.1",
"isomorphic-unfetch": "^3.0.0",
"next": "latest",
"prop-types": "^15.7.2",
"react": "^16.8.2",
......
import 'isomorphic-fetch'
export const { initEnvironment, createEnvironment } = (typeof window ===
'undefined'
? require('./server')
......
......@@ -16,7 +16,6 @@
"dotenv": "^8.0.0",
"dotenv-webpack": "^1.5.4",
"graphql": "^14.6.0",
"isomorphic-fetch": "^2.2.1",
"next": "latest",
"react": "^16.13.0",
"react-dom": "^16.13.0",
......
......@@ -9,7 +9,6 @@
},
"dependencies": {
"es6-promise": "4.1.1",
"isomorphic-unfetch": "2.0.0",
"next": "latest",
"next-redux-saga": "4.0.0",
"next-redux-wrapper": "2.0.0",
......
/* global fetch */
import { all, call, delay, put, take, takeLatest } from 'redux-saga/effects'
import es6promise from 'es6-promise'
import 'isomorphic-unfetch'
import { actionTypes, failure, loadDataSuccess, tickClock } from './actions'
......
import { Environment, Network, RecordSource, Store } from 'relay-runtime'
import fetch from 'isomorphic-unfetch'
let relayEnvironment = null
......
......@@ -16,7 +16,6 @@
"dotenv": "^8.2.0",
"dotenv-webpack": "^1.7.0",
"graphql": "^14.6.0",
"isomorphic-unfetch": "^3.0.0",
"next": "latest",
"react": "^16.13.0",
"react-dom": "^16.13.0",
......
......@@ -8,7 +8,6 @@
},
"dependencies": {
"@rematch/core": "^1.1.0",
"isomorphic-unfetch": "^3.0.0",
"next": "latest",
"react": "^16.8.4",
"react-dom": "^16.8.4",
......
import fetch from 'isomorphic-unfetch'
const github = {
state: {
users: [],
......
{
"name": "with-static-export",
"dependencies": {
"isomorphic-unfetch": "^3.0.0",
"next": "latest",
"react": "^16.11.0",
"react-dom": "^16.11.0",
......
import Head from 'next/head'
import fetch from 'isomorphic-unfetch'
import Post from '../components/post'
......
import { Component } from 'react'
import Link from 'next/link'
import Head from 'next/head'
import fetch from 'isomorphic-unfetch'
export async function getStaticPaths() {
const response = await fetch(
......
......@@ -8,7 +8,6 @@
"type-check": "tsc"
},
"dependencies": {
"isomorphic-unfetch": "3.0.0",
"next": "latest",
"react": "^16.12.0",
"react-dom": "^16.12.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment