Skip to content

Commit

Permalink
fix: setAuthFromQueryParams checks for window var (rethinkdb#770)
Browse files Browse the repository at this point in the history
* Fix, setAuthFromQueryParams() compatible with React Native (android)

`window` exists on Android but does not have a `location` property, so
it’s necessary to check that `window.location` is not null.

* TMP fix for client to work in React Native (breaks the CLI)

* Revert "TMP fix for client to work in React Native (breaks the CLI)"

This reverts commit 8b62b2d.
  • Loading branch information
Mikael Lirbank authored and deontologician committed Aug 22, 2016
1 parent 662541c commit b28efce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/src/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ export class TokenStorage {
}

setAuthFromQueryParams() {
const parsed = typeof window !== 'undefined' ?
const parsed = typeof window !== 'undefined' &&
typeof window.location !== 'undefined' ?
queryParse(window.location.search) : {}

if (parsed.horizon_token != null) {
Expand Down

0 comments on commit b28efce

Please sign in to comment.