Skip to content

Commit

Permalink
warn when creating a client without url (#512)
Browse files Browse the repository at this point in the history
* warn when creating a client without url

* convert to throwing an error
  • Loading branch information
JoviDeCroock authored Jan 17, 2020
1 parent cd8ea77 commit 4c75bf7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ export class Client {
activeOperations = Object.create(null) as ActiveOperations;

constructor(opts: ClientOptions) {
if (process.env.NODE_ENV !== 'production' && !opts.url) {
throw new Error('You are creating an urql-client without a url.');
}
this.url = opts.url;
this.fetchOptions = opts.fetchOptions;
this.fetch = opts.fetch;
Expand Down

0 comments on commit 4c75bf7

Please sign in to comment.