Skip to content

Commit ccd36e4

Browse files
Hailey RyuHailey Ryu
authored andcommitted
Added notification when token isn't set.
Enact-DCO-1.0-Signed-off-by: HanGyeol Ryu <[email protected]>
1 parent e0784b5 commit ccd36e4

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

graphql-example/src/App/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Detail from '../views/Detail';
1010
import Search from '../views/Search';
1111
import config from '../config.json';
1212

13+
1314
const client = new ApolloClient({
1415
uri: 'https://api.github.com/graphql',
1516
request: operation => {
@@ -81,6 +82,7 @@ class AppBase extends Component {
8182
return <ApolloProvider client={client}>
8283
<ActivityPanels {...this.props} onSelectBreadcrumb={this.handleSelectBreadcrumb} index={index}>
8384
<Search
85+
apiToken={config.token}
8486
onUserIdChange={this.onUserIdChange}
8587
onListSelectionChange={this.onListSelectionChange}
8688
onSearch={this.onSearch}

graphql-example/src/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"token":"a67285b115df55b4bc1b38"
2+
"token":""
33
}

graphql-example/src/views/Search.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {Header, Panel} from '@enact/moonstone/Panels';
22
import Input from '@enact/moonstone/Input';
33
import FormCheckboxItem from '@enact/moonstone/FormCheckboxItem';
44
import IconButton from '@enact/moonstone/IconButton';
5+
import Notification from '@enact/moonstone/Notification';
56
import kind from '@enact/core/kind';
67
import React from 'react';
78
import PropTypes from 'prop-types';
@@ -10,6 +11,7 @@ const SearchBase = kind({
1011
name: 'Detail',
1112

1213
propTypes: {
14+
apiToken: PropTypes.string,
1315
onListSelectionChange: PropTypes.func,
1416
onSearch: PropTypes.func,
1517
onUserIdChange: PropTypes.func,
@@ -34,10 +36,11 @@ const SearchBase = kind({
3436
}
3537
},
3638

37-
render: ({onInputChange, onSearch, onRepoSelection, onFolSelection, onOrgSelection, ...rest}) => {
39+
render: ({apiToken, onInputChange, onSearch, onRepoSelection, onFolSelection, onOrgSelection, ...rest}) => {
3840
delete rest.onUserIdChange;
3941
delete rest.onListSelectionChange;
4042
return (<Panel {...rest}>
43+
{!apiToken && <Notification open><p>Please set your github token in src/config.json.</p></Notification>}
4144
<Header title="Dev checks" type="compact" />
4245
<Input placeholder="Github id" onChange={onInputChange} dismissOnEnter />
4346
<IconButton onClick={onSearch} small={false} backgroundOpacity="transparent">search</IconButton>

0 commit comments

Comments
 (0)