Skip to content

Commit

Permalink
Use global fetch in browser, else use cross-fetch
Browse files Browse the repository at this point in the history
isomorphic-fetch uses the same browser polyfill as cross-fetch and
therefore returns the same error. isomorphic-fetch will be removed
as a dependency in the next commit.

Related pull request that was never merged: lquixada/cross-fetch#138
  • Loading branch information
njerig committed Apr 3, 2023
1 parent ea8359a commit 0ab149b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {GraphQLClient} from 'graphql-request';
import fetch from 'isomorphic-fetch';
import {fetch as crossFetch} from 'cross-fetch';
import {autocompleteSchoolQuery, searchTeacherQuery, getTeacherQuery} from './queries';
import {AUTH_TOKEN} from './constants';

const client = new GraphQLClient('https://www.ratemyprofessors.com/graphql', {
headers: {
authorization: `Basic ${AUTH_TOKEN}`
},
fetch
fetch: globalThis.fetch ?? crossFetch
});

export interface ISchoolFromSearch {
Expand Down

0 comments on commit 0ab149b

Please sign in to comment.