Skip to content

Commit dd8361e

Browse files
committed
use constants
1 parent dfe5511 commit dd8361e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/App.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ const axiosGitHubGraphQL = axios.create({
1010
},
1111
});
1212

13-
const title = 'React GraphQL GitHub Client';
13+
const TITLE = 'React GraphQL GitHub Client';
1414

15-
const issuesOfRepositoryQuery = `
15+
const ISSUES_OF_REPOSITORY = `
1616
query (
1717
$organization: String!,
1818
$repository: String!,
@@ -56,7 +56,7 @@ const issuesOfRepositoryQuery = `
5656
}
5757
`;
5858

59-
const addStarToRepositoryMutation = `
59+
const ADD_STAR = `
6060
mutation ($repositoryId: ID!) {
6161
addStar(input:{starrableId:$repositoryId}) {
6262
starrable {
@@ -66,7 +66,7 @@ const addStarToRepositoryMutation = `
6666
}
6767
`;
6868

69-
const removeStarToRepositoryMutation = `
69+
const REMOVE_STAR = `
7070
mutation ($repositoryId: ID!) {
7171
removeStar(input:{starrableId:$repositoryId}) {
7272
starrable {
@@ -80,21 +80,21 @@ const getIssuesOfRepository = (path, cursor) => {
8080
const [organization, repository] = path.split('/');
8181

8282
return axiosGitHubGraphQL.post('', {
83-
query: issuesOfRepositoryQuery,
83+
query: ISSUES_OF_REPOSITORY,
8484
variables: { organization, repository, cursor },
8585
});
8686
};
8787

8888
const addStarToRepository = repositoryId => {
8989
return axiosGitHubGraphQL.post('', {
90-
query: addStarToRepositoryMutation,
90+
query: ADD_STAR,
9191
variables: { repositoryId },
9292
});
9393
};
9494

9595
const removeStarFromRepository = repositoryId => {
9696
return axiosGitHubGraphQL.post('', {
97-
query: removeStarToRepositoryMutation,
97+
query: REMOVE_STAR,
9898
variables: { repositoryId },
9999
});
100100
};
@@ -224,7 +224,7 @@ class App extends Component {
224224

225225
return (
226226
<div>
227-
<h1>{title}</h1>
227+
<h1>{TITLE}</h1>
228228

229229
<form onSubmit={this.onSubmit}>
230230
<label htmlFor="url">

0 commit comments

Comments
 (0)