MCPcopy Create free account
hub / github.com/YashMarmat/FullStack_Ecommerce_App / userDetails

Function userDetails

frontend/src/actions/userActions.js:177–210  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

175
176// user details
177export const userDetails = (id) => async (dispatch, getState) => {
178
179 try {
180
181 dispatch({
182 type: USER_DETAILS_REQUEST
183 })
184
185 const {
186 userLoginReducer: { userInfo }
187 } = getState()
188
189 const config = {
190 headers: {
191 "Content-Type": "application/json",
192 Authorization: `Bearer ${userInfo.token}`
193 }
194 }
195
196 // call api
197 const { data } = await axios.get(`/account/user/${id}`, config)
198
199 dispatch({
200 type: USER_DETAILS_SUCCESS,
201 payload: data
202 })
203
204 } catch (error) {
205 dispatch({
206 type: USER_DETAILS_FAIL,
207 payload: error.response && error.response.data.details ? error.response.data.details : error.message
208 })
209 }
210}
211
212// user update details
213export const userUpdateDetails = (userData) => async (dispatch, getState) => {

Callers 2

AccountPage.jsFile · 0.90
AccountUpdatePageFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected