mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
Safe document.location access
`document.location` is not defined in react-native. Fixes #6512
This commit is contained in:
parent
632eabd37c
commit
59fa00cf78
@ -2,7 +2,11 @@ import { document } from 'global';
|
||||
import qs from 'qs';
|
||||
|
||||
export const getQueryParams = () => {
|
||||
return qs.parse(document.location.search, { ignoreQueryPrefix: true });
|
||||
// document.location is not defined in react-native
|
||||
if (document && document.location && document.location.search) {
|
||||
return qs.parse(document.location.search, { ignoreQueryPrefix: true });
|
||||
}
|
||||
return {};
|
||||
};
|
||||
|
||||
export const getQueryParam = key => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user