Skip to content

Commit

Permalink
part 15
Browse files Browse the repository at this point in the history
  • Loading branch information
rwieruch committed Sep 1, 2017
1 parent ccb9661 commit 2f70cec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 9 additions & 0 deletions src/api/story.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const HN_BASE_URL = 'http://hn.algolia.com/api/v1/search?query=';

const fetchStories = (query) =>
fetch(HN_BASE_URL + query)
.then(response => response.json());

export {
fetchStories,
};
7 changes: 1 addition & 6 deletions src/components/SearchStories.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ import React, { Component } from 'react';
import { observable, action } from 'mobx';
import { observer, inject } from 'mobx-react';
import Button from './Button';

const HN_BASE_URL = 'http://hn.algolia.com/api/v1/search?query=';

const fetchStories = (query) =>
fetch(HN_BASE_URL + query)
.then(response => response.json());
import { fetchStories } from '../api/story';

@inject('storyStore') @observer
class SearchStories extends Component {
Expand Down

0 comments on commit 2f70cec

Please sign in to comment.