diff --git a/src/js/components/App.jsx b/src/js/components/App.jsx index ffd1aaf..f3bef38 100644 --- a/src/js/components/App.jsx +++ b/src/js/components/App.jsx @@ -5,18 +5,22 @@ import Post from './Posts' const App = () => (
-
-

Articles

+ +
+

Articles

+

Add a new article

+

API posts

-
+
+
) diff --git a/src/js/middleware/index.js b/src/js/middleware/index.js index d60eeff..0dedf41 100644 --- a/src/js/middleware/index.js +++ b/src/js/middleware/index.js @@ -5,9 +5,7 @@ const forbiddenWords = ["spam", "money"] export function forbiddenWordsMiddleware({ dispatch }) { return function(next) { return function(action) { - // do your stuff if (action.type === ADD_ARTICLE) { - const foundWord = forbiddenWords.filter(word => action.payload.title.includes(word) ) diff --git a/src/js/sagas/api-saga.js b/src/js/sagas/api-saga.js index 38366bf..ce04a3b 100644 --- a/src/js/sagas/api-saga.js +++ b/src/js/sagas/api-saga.js @@ -14,6 +14,37 @@ function* workerSaga() { } function getData() { + // const token = 'token' + + // let myHeaders = new Headers({ + // 'Content-Type': 'text/plain', + // 'Content-Length': content.length.toString(), + // 'X-Custom-Header': 'ProcessThisImmediately', + // Authorization: `OAuth ${token}` + // }) + + // let heads = { + // authorization: 'OAuth oauth_consumer_key="consumer-key-for-app"', + // oauth_nonce="generated-nonce", + // oauth_signature="generated-signature", + // oauth_signature_method="HMAC-SHA1", + // oauth_timestamp="generated-timestamp", + // oauth_token="access-token-for-authed-user", + // oauth_version="1.0" + // } + + // let config = { + // method: 'GET', + // headers: myHeaders, + // } + + // let url = 'https://api.twitter.com/1.1/search/tweets.json?q=from%3Atwitterdev&result_type=mixed&count=2' + + // return fetch(url, config).then(response => { + // console.log(response) + // response.json() + // }) + return fetch("https://jsonplaceholder.typicode.com/posts").then(response => response.json() )