Skip to content

Commit

Permalink
fix: handle api secret and its warning in browser (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhatelmas committed Aug 1, 2022
1 parent b859914 commit e973fe5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,9 @@ export class StreamClient<StreamFeedGenerics extends DefaultGenerics = DefaultGe
this.baseAnalyticsUrl = process.env.STREAM_ANALYTICS_BASE_URL;

this.handlers = {};
this.browser = typeof this.options.browser !== 'undefined' ? this.options.browser : typeof window !== 'undefined';
this.node = !this.browser;
this.node = typeof window === 'undefined'; // use for real browser vs node behavior
// use for browser warnings
this.browser = typeof this.options.browser !== 'undefined' ? this.options.browser : !this.node;

if (this.node) {
const keepAlive = this.options.keepAlive === undefined ? true : this.options.keepAlive;
Expand All @@ -260,7 +261,7 @@ export class StreamClient<StreamFeedGenerics extends DefaultGenerics = DefaultGe
}

this.request = axios.default.create({
timeout: this.options.timeout || 10 * 1000, // 10 seconds
timeout: this.options.timeout || 10000,
withCredentials: false, // making sure cookies are not sent
...(this.nodeOptions || {}),
});
Expand Down

0 comments on commit e973fe5

Please sign in to comment.