Skip to content

Commit 4966394

Browse files
committed
MAGE-1101: changes after review
1 parent 82b4822 commit 4966394

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

view/frontend/web/js/internals/common.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
define(['jquery', 'algoliaBundle'], function ($, algoliaBundle) {
1+
define(
2+
['jquery', 'algoliaBundle', 'Magento_PageCache/js/form-key-provider',], function ($, algoliaBundle, formKeyInit) {
23
// Character maps supplied for more performant Regex ops
34
const SPECIAL_CHAR_ENCODE_MAP = {
45
'&': '&',
@@ -99,10 +100,10 @@ define(['jquery', 'algoliaBundle'], function ($, algoliaBundle) {
99100
};
100101

101102
window.getCookie = function(name) {
102-
var cookie,
103-
i,
104-
cookieName = name + "=",
105-
cookieArr = document.cookie.split(';');
103+
let cookie, i;
104+
105+
const cookieName = name + "=",
106+
cookieArr = document.cookie.split(';');
106107

107108
for (i = 0; i < cookieArr.length; i++) {
108109
cookie = cookieArr[i];
@@ -223,11 +224,7 @@ define(['jquery', 'algoliaBundle'], function ($, algoliaBundle) {
223224
// Add to cart parameters
224225
var action = algoliaConfig.instant.addToCartParams.action + 'product/' + hit.objectID + '/';
225226

226-
var correctFKey = getCookie('form_key');
227-
228-
if (correctFKey != "" && algoliaConfig.instant.addToCartParams.formKey != correctFKey) {
229-
algoliaConfig.instant.addToCartParams.formKey = correctFKey;
230-
}
227+
algoliaConfig.instant.addToCartParams.formKey = getCookie('form_key');
231228

232229
hit.addToCart = {
233230
'action': action,

0 commit comments

Comments
 (0)