{"ast":null,"code":"import _objectSpread from\"C:/Users/user/Desktop/05mediaSocial/client/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";import{DELETE_COMMENT,DELETE_POST,EDIT_COMMENT,GET_POSTS,LIKE_POST,UNLIKE_POST,UPDATE_POST}from\"../actions/post.actions\";var initialState={};export default function postReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:initialState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case GET_POSTS:return action.payload;case UPDATE_POST:return state.map(function(post){if(postReducer._id===action.payload.postId){return _objectSpread(_objectSpread({},post),{},{message:action.payload.message});}else return post;});case DELETE_POST:return state.filter(function(post){return post._id!==action.payload.postId;});default:return state;}}","map":{"version":3,"names":["DELETE_COMMENT","DELETE_POST","EDIT_COMMENT","GET_POSTS","LIKE_POST","UNLIKE_POST","UPDATE_POST","initialState","postReducer","state","action","type","payload","map","post","_id","postId","message","filter"],"sources":["C:/Users/user/Desktop/05mediaSocial/client/src/reducers/post.reducer.js"],"sourcesContent":["import { DELETE_COMMENT,\r\n  DELETE_POST,\r\n  EDIT_COMMENT,\r\n  GET_POSTS,\r\n  LIKE_POST,\r\n  UNLIKE_POST,\r\n  UPDATE_POST, } from \"../actions/post.actions\";\r\n\r\nconst initialState = {};\r\n\r\nexport default function postReducer(state = initialState, action) {\r\n  switch (action.type) {\r\n    case GET_POSTS:\r\n      return action.payload;\r\n    \r\n\r\n      case UPDATE_POST:\r\n        return state.map((post)=>{\r\n          if(postReducer._id===action.payload.postId){\r\n            return{\r\n              ...post,\r\n              message:action.payload.message\r\n            }\r\n          }else return post\r\n        } )\r\n\r\n      case DELETE_POST:\r\n        return state.filter((post)=>post._id !== action.payload.postId)\r\n      default:\r\n        return state\r\n    }\r\n\r\n} "],"mappings":"+HAAA,OAASA,cAAc,CACrBC,WAAW,CACXC,YAAY,CACZC,SAAS,CACTC,SAAS,CACTC,WAAW,CACXC,WAAW,KAAS,yBAAyB,CAE/C,GAAMC,aAAY,CAAG,CAAC,CAAC,CAEvB,cAAe,SAASC,YAAW,EAA+B,IAA9BC,MAAK,2DAAGF,YAAY,IAAEG,OAAM,2CAC9D,OAAQA,MAAM,CAACC,IAAI,EACjB,IAAKR,UAAS,CACZ,MAAOO,OAAM,CAACE,OAAO,CAGrB,IAAKN,YAAW,CACd,MAAOG,MAAK,CAACI,GAAG,CAAC,SAACC,IAAI,CAAG,CACvB,GAAGN,WAAW,CAACO,GAAG,GAAGL,MAAM,CAACE,OAAO,CAACI,MAAM,CAAC,CACzC,sCACKF,IAAI,MACPG,OAAO,CAACP,MAAM,CAACE,OAAO,CAACK,OAAO,GAElC,CAAC,IAAK,OAAOH,KAAI,CACnB,CAAC,CAAE,CAEL,IAAKb,YAAW,CACd,MAAOQ,MAAK,CAACS,MAAM,CAAC,SAACJ,IAAI,QAAGA,KAAI,CAACC,GAAG,GAAKL,MAAM,CAACE,OAAO,CAACI,MAAM,GAAC,CACjE,QACE,MAAOP,MAAK,EAGpB"},"metadata":{},"sourceType":"module","externalDependencies":[]}