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

Function getSingleAddress

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

Source from the content-addressed store, hash-verified

337
338// get user single address
339export const getSingleAddress = (id) => async (dispatch, getState) => {
340 try {
341 dispatch({
342 type: GET_SINGLE_ADDRESS_REQUEST
343 })
344
345 const {
346 userLoginReducer: { userInfo }
347 } = getState()
348
349 const config = {
350 headers: {
351 "Content-Type": "application/json",
352 Authorization: `Bearer ${userInfo.token}`
353 }
354 }
355
356 // call api
357 const { data } = await axios.get(
358 `/account/address-details/${id}/`,
359 config
360 )
361
362 dispatch({
363 type: GET_SINGLE_ADDRESS_SUCCESS,
364 payload: data
365 })
366
367 } catch (error) {
368 dispatch({
369 type: GET_SINGLE_ADDRESS_FAIL,
370 payload: error.response && error.response.data.details ? error.response.data.details : error.message
371 })
372 }
373}
374
375
376// create user address

Callers 2

ChargeCardComponentFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected