Last active
October 2, 2015 13:47
-
-
Save ruprict/3d582ff5f029edf0def3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function removeFromCart(sku: string) { | |
return bind(cookie('token'), (token) => { | |
var headers = { | |
'Authorization': `Bearer ${token}`, | |
'Content-Type': 'application/json', | |
}; | |
return bind(fetch(`${process.env.CART_API_URL}cart/products/${sku}`, | |
{ | |
mode: process.env.FETCH_MODE, | |
headers: headers, | |
method: 'DELETE', | |
} | |
), () => { | |
console.log("remove"); | |
return removeFromCartSuccess(sku) | |
}, | |
json => ( removeFromCartFailure(json)) ); | |
}); | |
}; | |
const removeFromCartSuccess = createAction(REMOVE_FROM_CART_SUCCESS); | |
const removeFromCartFailure = createAction(REMOVE_FROM_CART_FAILURE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment