-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
54 additions
and
26 deletions.
There are no files selected for viewing
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
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
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
42 changes: 42 additions & 0 deletions
42
_dev/js/theme/core/cart/request/cart/updateCartContentRequest.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import useDefaultHttpRequest from "../../../../components/http/useDefaultHttpRequest"; | ||
import prestashop from "prestashop"; | ||
/** | ||
* @typedef ServerResponse | ||
* @type {object} | ||
* @property {string} cart_detailed - cart detailed html used in cart page | ||
* @property {string} cart_detailed_actions - cart actions html used in cart page | ||
* @property {string} cart_detailed_totals - cart totals html used in cart page | ||
* @property {string} cart_summary_items_subtotal - cart summary items subtotal html used in checkout page | ||
* @property {string} cart_summary_products - cart summary products html used in checkout page | ||
* @property {string} cart_summary_subtotals_container - cart summary products html used in checkout page | ||
* @property {string} cart_summary_top - cart summary top html used in checkout page | ||
* @property {string} cart_summary_totals - cart summary totals html used in checkout page | ||
* @property {string} cart_voucher - cart voucher html used in checkout page | ||
*/ | ||
|
||
/** | ||
* Add voucher to cart request | ||
* @example | ||
* const { getRequest } = updateCartContentRequest(); | ||
* | ||
* try { | ||
* const resp = await getRequest(); | ||
* } catch (error) { | ||
* console.error(error); | ||
* } | ||
* @returns {{getRequest: (function(): Promise<ServerResponse>)}} | ||
*/ | ||
const updateCartContentRequest = () => { | ||
const payloadToSend = { | ||
action: 'refresh', | ||
ajax: 1, | ||
}; | ||
|
||
const getRequest = () => useDefaultHttpRequest(prestashop.urls.pages.cart, payloadToSend); | ||
|
||
return { | ||
getRequest, | ||
} | ||
} | ||
|
||
export default updateCartContentRequest; |
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
This file was deleted.
Oops, something went wrong.