Skip to content

Commit 0d47fe0

Browse files
committed
Flux - 8 - Implementing Fetch
1 parent 92a5b98 commit 0d47fe0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

imgur-client/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"react-router": "^1.0.0-beta2",
2222
"reactify": "^1.1.0",
2323
"vinyl-source-stream": "^1.1.0",
24-
"watchify": "^2.4.0"
24+
"watchify": "^2.4.0",
25+
"whatwg-fetch": "^0.9.0"
2526
},
2627
"devDependencies": {}
2728
}

imgur-client/src/utils/api.jsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var Fetch = require('whatwg-fetch');
2+
var rootUrl = 'https://api.imgur.com/3/';
3+
var apiKey = '430d6820d865788';
4+
5+
module.exports = {
6+
get: function(url) {
7+
return fetch(rootUrl + url, {
8+
headers: {
9+
'Authorization': 'Client-ID ' + apiKey
10+
}
11+
});
12+
}
13+
};

0 commit comments

Comments
 (0)