Skip to content

Commit b6a6e59

Browse files
committed
part 15
1 parent 94efe05 commit b6a6e59

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/api/story.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const HN_BASE_URL = 'http://hn.algolia.com/api/v1/search?query=';
2+
3+
const fetchStories = query =>
4+
fetch(HN_BASE_URL + query)
5+
.then(response => response.json());
6+
7+
export {
8+
fetchStories,
9+
};

src/sagas/story.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import { call, put } from 'redux-saga/effects';
22
import { doAddStories } from '../actions/story';
3-
4-
const HN_BASE_URL = 'http://hn.algolia.com/api/v1/search?query=';
5-
6-
const fetchStories = query =>
7-
fetch(HN_BASE_URL + query)
8-
.then(response => response.json());
3+
import { fetchStories } from '../api/story';
94

105
function* handleFetchStories(action) {
116
const { query } = action;

0 commit comments

Comments
 (0)