Browse Source

Updated StoryRoot graphql query according to api changes

1.0
Gisle Aune 6 years ago
parent
commit
06bc7e5a1b
  1. 4
      rpdata-ui/src/App.js
  2. 7
      rpdata-ui/src/routes/story/StoryRoot.js
  3. 13
      rpdata-ui/src/routes/story/gql/StoryRoot.js

4
rpdata-ui/src/App.js

@ -4,7 +4,7 @@ import { Route, Router, Redirect, Switch } from "react-router-dom";
import StoryRoot from './routes/story/StoryRoot';
import LogsIndex from './routes/logs/LogsIndex';
class App extends Component {
export default class App extends Component {
render() {
return (
<div className="App">
@ -18,6 +18,4 @@ class App extends Component {
}
}
export default App;
/* See ./common/Menu.js to change the top navbar */

7
rpdata-ui/src/routes/story/StoryRoot.js

@ -4,7 +4,8 @@ import { Query } from 'react-apollo';
import Background from '../../common/Background';
import StoryMenu from './StoryMenu';
import INDEX_QUERY from "./gql/StoryIndex";
import storyRootQuery from "./gql/StoryRoot";
import { LoadingScreen } from '../../common/LoadingScreen';
export class StoryIndex extends Component {
render() {
@ -20,9 +21,9 @@ export class StoryIndex extends Component {
}
export default () => (
<Query query={INDEX_QUERY}>
<Query query={storyRootQuery}>
{({ loading, error, data }) => {
if (loading) return 'Loading...';
if (loading) return <LoadingScreen className="theme-story" />;
if (error) return `Error! ${error.message}`;
return <StoryIndex {...data} />

13
rpdata-ui/src/routes/story/gql/StoryIndex.js → rpdata-ui/src/routes/story/gql/StoryRoot.js

@ -1,23 +1,12 @@
import gql from "graphql-tag"
export default gql`
query StoryIndex {
query StoryRoot {
categoryType: __type(name: "StoryCategory") {
enumValues {
name
description
}
}
stories(input: {}) {
id
name
author
open
tags {
kind
name
}
}
}
`
Loading…
Cancel
Save