Commit 729ffb8a authored by mic's avatar mic

fix-warning

parent 1d3f0e32
Pipeline #27 passed with stages
in 3 minutes and 39 seconds
[{"/home/mli/react-flask-poc/react-client/src/index.js":"1","/home/mli/react-flask-poc/react-client/src/App.js":"2","/home/mli/react-flask-poc/react-client/src/reportWebVitals.js":"3","/home/mli/react-flask-poc/react-client/src/components/Posts.js":"4","/home/mli/react-flask-poc/react-client/src/components/Postform.js":"5","/home/mli/react-flask-poc/react-client/src/store.js":"6","/home/mli/react-flask-poc/react-client/src/reducers/index.js":"7","/home/mli/react-flask-poc/react-client/src/reducers/postReducer.js":"8","/home/mli/react-flask-poc/react-client/src/actions/types.js":"9","/home/mli/react-flask-poc/react-client/src/actions/postActions.js":"10"},{"size":500,"mtime":1608066788746,"results":"11","hashOfConfig":"12"},{"size":357,"mtime":1608082528849,"results":"13","hashOfConfig":"12"},{"size":362,"mtime":1608066788746,"results":"14","hashOfConfig":"12"},{"size":1030,"mtime":1608087500736,"results":"15","hashOfConfig":"12"},{"size":1448,"mtime":1608086637568,"results":"16","hashOfConfig":"12"},{"size":371,"mtime":1608085288315,"results":"17","hashOfConfig":"12"},{"size":138,"mtime":1608082858554,"results":"18","hashOfConfig":"12"},{"size":565,"mtime":1608086969576,"results":"19","hashOfConfig":"12"},{"size":73,"mtime":1608082975157,"results":"20","hashOfConfig":"12"},{"size":676,"mtime":1608085818986,"results":"21","hashOfConfig":"12"},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},"1j0yot5",{"filePath":"25","messages":"26","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"33","messages":"34","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"35","messages":"36","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"37","messages":"38","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"39","messages":"40","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"41","messages":"42","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},"/home/mli/react-flask-poc/react-client/src/index.js",[],["43","44"],"/home/mli/react-flask-poc/react-client/src/App.js",[],"/home/mli/react-flask-poc/react-client/src/reportWebVitals.js",[],"/home/mli/react-flask-poc/react-client/src/components/Posts.js",[],"/home/mli/react-flask-poc/react-client/src/components/Postform.js",[],"/home/mli/react-flask-poc/react-client/src/store.js",[],"/home/mli/react-flask-poc/react-client/src/reducers/index.js",[],"/home/mli/react-flask-poc/react-client/src/reducers/postReducer.js",["45"],"/home/mli/react-flask-poc/react-client/src/actions/types.js",[],"/home/mli/react-flask-poc/react-client/src/actions/postActions.js",[],{"ruleId":"46","replacedBy":"47"},{"ruleId":"48","replacedBy":"49"},{"ruleId":"50","severity":1,"message":"51","line":8,"column":1,"nodeType":"52","endLine":27,"endColumn":2},"no-native-reassign",["53"],"no-negated-in-lhs",["54"],"import/no-anonymous-default-export","Unexpected default export of anonymous function","ExportDefaultDeclaration","no-global-assign","no-unsafe-negation"] [{"/home/mli/react-flask-poc/react-client/src/index.js":"1","/home/mli/react-flask-poc/react-client/src/App.js":"2","/home/mli/react-flask-poc/react-client/src/reportWebVitals.js":"3","/home/mli/react-flask-poc/react-client/src/components/Posts.js":"4","/home/mli/react-flask-poc/react-client/src/components/Postform.js":"5","/home/mli/react-flask-poc/react-client/src/store.js":"6","/home/mli/react-flask-poc/react-client/src/reducers/index.js":"7","/home/mli/react-flask-poc/react-client/src/reducers/postReducer.js":"8","/home/mli/react-flask-poc/react-client/src/actions/types.js":"9","/home/mli/react-flask-poc/react-client/src/actions/postActions.js":"10"},{"size":500,"mtime":1608066788746,"results":"11","hashOfConfig":"12"},{"size":357,"mtime":1608082528849,"results":"13","hashOfConfig":"12"},{"size":362,"mtime":1608066788746,"results":"14","hashOfConfig":"12"},{"size":1030,"mtime":1608087500736,"results":"15","hashOfConfig":"12"},{"size":1448,"mtime":1608086637568,"results":"16","hashOfConfig":"12"},{"size":371,"mtime":1608085288315,"results":"17","hashOfConfig":"12"},{"size":138,"mtime":1608082858554,"results":"18","hashOfConfig":"12"},{"size":585,"mtime":1608088549165,"results":"19","hashOfConfig":"12"},{"size":73,"mtime":1608082975157,"results":"20","hashOfConfig":"12"},{"size":677,"mtime":1608088480131,"results":"21","hashOfConfig":"12"},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},"1j0yot5",{"filePath":"25","messages":"26","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"33","messages":"34","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"35","messages":"36","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"37","messages":"38","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"39","messages":"40","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"41","messages":"42","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},"/home/mli/react-flask-poc/react-client/src/index.js",[],["43","44"],"/home/mli/react-flask-poc/react-client/src/App.js",[],"/home/mli/react-flask-poc/react-client/src/reportWebVitals.js",[],"/home/mli/react-flask-poc/react-client/src/components/Posts.js",[],"/home/mli/react-flask-poc/react-client/src/components/Postform.js",[],"/home/mli/react-flask-poc/react-client/src/store.js",[],"/home/mli/react-flask-poc/react-client/src/reducers/index.js",[],"/home/mli/react-flask-poc/react-client/src/reducers/postReducer.js",[],"/home/mli/react-flask-poc/react-client/src/actions/types.js",[],"/home/mli/react-flask-poc/react-client/src/actions/postActions.js",[],{"ruleId":"45","replacedBy":"46"},{"ruleId":"47","replacedBy":"48"},"no-native-reassign",["49"],"no-negated-in-lhs",["50"],"no-global-assign","no-unsafe-negation"]
\ No newline at end of file \ No newline at end of file
...@@ -8,15 +8,14 @@ export const fetchPosts=()=>dispatch=>{ ...@@ -8,15 +8,14 @@ export const fetchPosts=()=>dispatch=>{
payload: posts payload: posts
})); }));
} }
export const createPost=(post)=>dispatch=>{ export const createPost=(postData)=>dispatch=>{
fetch('https://jsonplaceholder.typicode.com/posts', fetch('https://jsonplaceholder.typicode.com/posts',
{ {
method:'POST', method:'POST',
header:{'content-type':'application/json'}, header:{'content-type':'application/json'},
body: JSON.stringify(post) body: JSON.stringify(postData)
}).then(res=>res.json()) }).then(res=>res.json())
.then(post=>dispatch({ .then(post=>dispatch({type: NEW_POST ,
type:NEW_POST,
payload: post payload: post
})); }));
}; };
\ No newline at end of file
...@@ -4,24 +4,24 @@ const initialState={ ...@@ -4,24 +4,24 @@ const initialState={
items : [] , items : [] ,
item : {} item : {}
}; };
const postReducer = (state=initialState,action) =>{
export default function(state=initialState,action){
switch(action.type){ switch(action.type){
case FETCH_POSTS: case FETCH_POSTS:
console.log('reducer'); console.log('reducer');
return { return {
...state, ...state,
items: action.payload items: action.payload
,item: {}
} };
case NEW_POST: case NEW_POST:
return { return {
...state, ...state,
item: action.payload item: action.payload
} };
default: default:
return state; return state;
} }
} }
\ No newline at end of file export default postReducer;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment