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