Skip to content

Commit eeb4632

Browse files
committed
final updates
1 parent 4945e50 commit eeb4632

File tree

9 files changed

+18
-29
lines changed

9 files changed

+18
-29
lines changed

server/.graphqlconfig.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
projects:
22
app:
3-
schemaPath: "src/schema.graphql"
3+
schemaPath: src/schema.graphql
44
extensions:
55
endpoints:
6-
default: "http://localhost:4000"
6+
default: http://localhost:4000
77
database:
8-
schemaPath: "src/generated/database.graphql"
8+
schemaPath: src/generated/graphcool.graphql
99
extensions:
10-
graphcool: graphcool.yml
10+
graphcool: ./database/graphcool.yml
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# the name for the service (will be part of the service's HTTP endpoint)
2-
service: hackernews-node-02
2+
service: hackernews-node
33

44
# the cluster and stage the service is deployed to
55
stage: dev
@@ -10,7 +10,4 @@ cluster: local
1010
secret: mysecret123
1111

1212
# the file path pointing to your data model
13-
datamodel: database/datamodel.graphql
14-
15-
seed:
16-
import: database/seed.graphql
13+
datamodel: datamodel.graphql

server/database/seed.graphql

Lines changed: 0 additions & 8 deletions
This file was deleted.

server/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const server = new GraphQLServer({
1818
context: req => ({
1919
...req,
2020
db: new Graphcool({
21-
typeDefs: 'src/generated/database.graphql',
21+
typeDefs: 'src/generated/graphcool.graphql',
2222
endpoint: 'http://localhost:60000/hackernews-node-02/dev',
2323
secret: 'mysecret123',
2424
}),

server/src/schema.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# import Link, Vote from "./generated/database.graphql"
1+
# import Link, Vote from "./generated/graphcool.graphql"
22

33
type Query {
44
feed(filter: String, skip: Int, first: Int, orderBy: LinkOrderByInput): Feed!

src/components/CreateLink.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class CreateLink extends Component {
6262
}
6363
}
6464

65-
const CREATE_LINK_MUTATION = gql`
65+
const POST_MUTATION = gql`
6666
mutation PostMutation($description: String!, $url: String!) {
6767
post(description: $description, url: $url) {
6868
id
@@ -77,6 +77,6 @@ const CREATE_LINK_MUTATION = gql`
7777
}
7878
`
7979

80-
export default graphql(CREATE_LINK_MUTATION, { name: 'postMutation' })(
80+
export default graphql(POST_MUTATION, { name: 'postMutation' })(
8181
CreateLink,
8282
)

src/components/Link.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import gql from 'graphql-tag'
66

77
class Link extends Component {
88
render() {
9-
const isAuthenticated = localStorage.getItem(AUTH_TOKEN)
9+
const authToken = localStorage.getItem(AUTH_TOKEN)
1010
return (
1111
<div className="flex mt2 items-start">
1212
<div className="flex items-center">
1313
<span className="gray">{this.props.index + 1}.</span>
14-
{isAuthenticated && (
14+
{authToken && (
1515
<div className="ml1 gray f11" onClick={() => this._voteForLink()}>
1616
1717
</div>

src/components/Search.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Link from './Link'
66
class Search extends Component {
77
state = {
88
links: [],
9-
searchText: '',
9+
filter: '',
1010
}
1111

1212
render() {
@@ -16,7 +16,7 @@ class Search extends Component {
1616
Search
1717
<input
1818
type="text"
19-
onChange={e => this.setState({ searchText: e.target.value })}
19+
onChange={e => this.setState({ filter: e.target.value })}
2020
/>
2121
<button onClick={() => this._executeSearch()}>OK</button>
2222
</div>
@@ -28,19 +28,19 @@ class Search extends Component {
2828
}
2929

3030
_executeSearch = async () => {
31-
const { searchText } = this.state
31+
const { filter } = this.state
3232
const result = await this.props.client.query({
3333
query: FEED_SEARCH_QUERY,
34-
variables: { searchText },
34+
variables: { filter },
3535
})
3636
const links = result.data.feed.links
3737
this.setState({ links })
3838
}
3939
}
4040

4141
const FEED_SEARCH_QUERY = gql`
42-
query FeedSearchQuery($searchText: String!) {
43-
feed(filter: $searchText) {
42+
query FeedSearchQuery($filter: String!) {
43+
feed(filter: $filter) {
4444
links {
4545
id
4646
url

0 commit comments

Comments
 (0)