mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
add env to handle graphql endpoint for graphiql-online (#1178)
[skip ci]
This commit is contained in:
parent
2855e07b11
commit
12231bc062
@ -6,13 +6,23 @@ import { push } from 'react-router-redux';
|
||||
|
||||
class ApiExplorer extends Component {
|
||||
componentWillMount() {
|
||||
const localStorageUrl = window.localStorage.getItem('ONLINE_GRAPHIQL_ENDPOINT');
|
||||
if (!this.props.graphqlEndpoint && localStorageUrl === null) {
|
||||
let localStorageUrl;
|
||||
if (window.__env.graphqlEndpoint && window.__env.graphqlEndpoint !== 'undefined') {
|
||||
localStorageUrl = window.__env.graphqlEndpoint;
|
||||
} else {
|
||||
localStorageUrl = window.localStorage.getItem('ONLINE_GRAPHIQL_ENDPOINT');
|
||||
}
|
||||
if (!this.props.graphqlEndpoint && (localStorageUrl === 'undefined' || localStorage === null)) {
|
||||
this.props.dispatch(push('/'));
|
||||
}
|
||||
}
|
||||
render() {
|
||||
const localStorageUrl = window.localStorage.getItem('ONLINE_GRAPHIQL_ENDPOINT');
|
||||
let localStorageUrl;
|
||||
if (window.__env.graphqlEndpoint && window.__env.graphqlEndpoint !== 'undefined') {
|
||||
localStorageUrl = window.__env.graphqlEndpoint;
|
||||
} else {
|
||||
localStorageUrl = window.localStorage.getItem('ONLINE_GRAPHIQL_ENDPOINT');
|
||||
}
|
||||
const styles = require('./ApiExplorer.scss');
|
||||
const wrapperClass = styles.apiExplorerWrapper;
|
||||
const requestStyles = '';
|
||||
|
@ -1,5 +1,13 @@
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-130585335-1"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'UA-130585335-1');
|
||||
</script>
|
||||
<link rel="icon" type="image/png" href="./favicon.png" />
|
||||
<title>GraphiQL Online with Headers | Built by Hasura</title>
|
||||
<meta name="title" content="GraphiQL Online with Headers | Built by Hasura" />
|
||||
|
Loading…
Reference in New Issue
Block a user