Skip to content

Commit

Permalink
Added query for local state
Browse files Browse the repository at this point in the history
  • Loading branch information
tmvnkr committed Dec 11, 2018
1 parent fb4f44b commit 36de5c0
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 15 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"dist": "react-scripts build && mv build ../server/public",
"test": "react-scripts test",
"eject": "react-scripts eject"
"test": "react-scripts test"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
3 changes: 2 additions & 1 deletion src/components/sidebar/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Link } from '@reach/router';
import ThemeSelect from './ThemeSelect';

export default function Sidebar(props) {
const { handleThemeChange } = props;
return (
<Background>
Sidebar
Expand All @@ -16,7 +17,7 @@ export default function Sidebar(props) {
<Link to="launchpads">
<h1>Launchpads</h1>
</Link>
<ThemeSelect handleThemeChange={props.handleThemeChange} />
<ThemeSelect handleThemeChange={handleThemeChange} />
</Background>
);
}
Expand Down
6 changes: 1 addition & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ const cache = new InMemoryCache();
const client = new ApolloClient({
cache,
link: new HttpLink({
uri: 'http://localhost:5000/graphql',
headers: {
'client-name': 'Space Explorer [web]',
'client-version': '1.0.0'
}
uri: 'http://localhost:5000/graphql'
}),
clientState: {
defaults,
Expand Down
7 changes: 7 additions & 0 deletions src/queries/GET_THEME.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import gql from 'graphql-tag';

export default gql`
query getTheme {
theme @client
}
`;
3 changes: 3 additions & 0 deletions src/queries/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { default as GET_THEME } from './GET_THEME.gql';

export { GET_THEME };
16 changes: 13 additions & 3 deletions src/state/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { default as defaults } from './defaults';
import { default as resolvers } from './resolvers';
// import gql from 'graphql-tag';
// import GET_THEME from '../queries';

export { defaults, resolvers };
// export const defaults = {
// themeIsDark: true
// };

// export const resolvers = {
// Mutation: {
// toggleTheme: (_parent, _args, { cache }) => {
// const query = GET_THEME;
// }
// }
// };
3 changes: 0 additions & 3 deletions src/state/resolvers.js
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
const resolvers = {};

export default resolvers;

0 comments on commit 36de5c0

Please sign in to comment.