{"ast":null,"code":"import axios from \"axios\";\nexport const GET_USER = \"GET_USER\";\nexport const UPLOAD_PICTURE = \"UPLOAD_PICTURE\";\nexport const UPDATE_BIO = \"UPDATE_BIO\";\nexport const FOLLOW_USER = \"FOLLOW_USER\";\nexport const UNFOLLOW_USER = \"UNFOLLOW_USER\";\nexport const getUser = uid => {\n  return dispatch => {\n    return axios.get(`http://localhost:5001/api/user/${uid}`).then(res => {\n      dispatch({\n        type: GET_USER,\n        payload: res.data\n      });\n    }).catch(err => console.log(err));\n  };\n};\nexport const uploadPicture = (data, id) => {\n  return dispatch => {\n    return axios.post(`http://localhost:5001/api/user/upload`, data).then(res => {\n      return axios.get(`http://localhost:5001/api/user/${id}`).then(res => {\n        dispatch({\n          type: UPLOAD_PICTURE,\n          payload: res.data.picture\n        });\n      });\n    }).catch(err => console.log(err));\n  };\n};\nexport const updateBio = (userId, bio) => {\n  return dispatch => {\n    return axios({\n      method: 'put',\n      url: `http://localhost:5001/api/user/` + userId,\n      data: {\n        bio\n      }\n    }).then(res => {\n      dispatch({\n        type: UPDATE_BIO,\n        payload: bio\n      });\n    }).catch(err => console.log(err));\n  };\n};\nexport const followUser = (followerId, idToFollow) => {\n  return dispatch => {\n    return axios({\n      method: `http://localhost:5001/api/user/follow`,\n      url: \"\"\n    });\n  };\n};","map":{"version":3,"names":["axios","GET_USER","UPLOAD_PICTURE","UPDATE_BIO","FOLLOW_USER","UNFOLLOW_USER","getUser","uid","dispatch","get","then","res","type","payload","data","catch","err","console","log","uploadPicture","id","post","picture","updateBio","userId","bio","method","url","followUser","followerId","idToFollow"],"sources":["C:/Users/user/Desktop/05mediaSocial/client/src/actions/user.actions.js"],"sourcesContent":["import axios from \"axios\";\r\n\r\nexport const GET_USER= \"GET_USER\";\r\nexport const UPLOAD_PICTURE=\"UPLOAD_PICTURE\";\r\nexport const UPDATE_BIO=\"UPDATE_BIO\";\r\nexport const FOLLOW_USER=\"FOLLOW_USER\";\r\nexport const UNFOLLOW_USER=\"UNFOLLOW_USER\";\r\n\r\nexport const getUser=(uid)=>{\r\n\r\n    return(dispatch)=>{\r\n\r\n        return axios\r\n        .get(`http://localhost:5001/api/user/${uid}`)\r\n        .then((res)=>{\r\n            dispatch({type:GET_USER,payload:res.data})\r\n        })\r\n        .catch((err)=>console.log(err))\r\n\r\n    }\r\n\r\n};\r\n\r\n\r\nexport const uploadPicture =(data,id)=>{\r\n    return (dispatch)=>{\r\n        return axios\r\n        .post(`http://localhost:5001/api/user/upload`,data)\r\n        .then((res)=>{\r\n           return axios\r\n           .get(`http://localhost:5001/api/user/${id}`)\r\n           .then((res=>{\r\n            dispatch({type:UPLOAD_PICTURE,payload:res.data.picture} )\r\n           }))\r\n        })\r\n        .catch((err)=>console.log(err))\r\n    }\r\n};\r\n\r\n\r\nexport const updateBio=(userId,bio)=>{\r\n    return(dispatch)=>{\r\n        return axios({\r\n            method:'put',\r\n            url:`http://localhost:5001/api/user/`+ userId,\r\n            data:{bio}\r\n        })\r\n        .then((res)=>{\r\n            dispatch({type:UPDATE_BIO,payload:bio})\r\n        })\r\n        .catch((err)=>console.log(err))\r\n    }\r\n\r\n}\r\nexport const followUser=(followerId,idToFollow)=>{\r\n    return(dispatch)=>{\r\n        return axios({\r\n            method:`http://localhost:5001/api/user/follow`,\r\n            url:\"\"\r\n        })\r\n    }\r\n}"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAO,MAAMC,QAAQ,GAAE,UAAU;AACjC,OAAO,MAAMC,cAAc,GAAC,gBAAgB;AAC5C,OAAO,MAAMC,UAAU,GAAC,YAAY;AACpC,OAAO,MAAMC,WAAW,GAAC,aAAa;AACtC,OAAO,MAAMC,aAAa,GAAC,eAAe;AAE1C,OAAO,MAAMC,OAAO,GAAEC,GAAG,IAAG;EAExB,OAAOC,QAAQ,IAAG;IAEd,OAAOR,KAAK,CACXS,GAAG,CAAE,kCAAiCF,GAAI,EAAC,CAAC,CAC5CG,IAAI,CAAEC,GAAG,IAAG;MACT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