@salla.sa/applepay 2.14.503 → 2.14.504
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/http.js +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salla.sa/applepay",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.504",
|
|
4
4
|
"description": "Salla Apple Pay light",
|
|
5
5
|
"main": "dist/app.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"axios": "^1.10.0"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "8f067312768b3d9e7dcacf2c3b1a9b4701792566"
|
|
30
30
|
}
|
package/src/http.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import axios from 'axios'
|
|
2
|
+
// display currency (these requests use the global axios, not salla's instance). Legacy-BE stores
|
|
3
|
+
// (isLegacyBuyNowBE) keep the old behavior — no override. Set once on the axios defaults so
|
|
4
|
+
// every method inherits it without overriding the rest of the headers.
|
|
5
|
+
function setBaseCurrencyHeader() {
|
|
6
|
+
axios.defaults.headers.common.currency = salla?.config?.get?.('user.currency_code');
|
|
7
|
+
}
|
|
2
8
|
|
|
3
9
|
export default {
|
|
4
10
|
request(method, url, data, successCb = null, errorCb = null) {
|
|
11
|
+
setBaseCurrencyHeader();
|
|
5
12
|
return axios
|
|
6
13
|
.request({url, data, method: method.toLowerCase(), responseType: 'json'})
|
|
7
14
|
.then(successCb)
|
|
@@ -10,6 +17,7 @@ export default {
|
|
|
10
17
|
|
|
11
18
|
get(url, successCb = null, errorCb = null, data) {
|
|
12
19
|
// return this.request('get', url, data, successCb, errorCb);
|
|
20
|
+
setBaseCurrencyHeader();
|
|
13
21
|
return axios
|
|
14
22
|
.get(url, {params: data})
|
|
15
23
|
.then(successCb)
|
|
@@ -41,10 +49,12 @@ export default {
|
|
|
41
49
|
/**
|
|
42
50
|
* @deprecated to support legacy themes
|
|
43
51
|
*/
|
|
52
|
+
setBaseCurrencyHeader();
|
|
44
53
|
$.ajax({
|
|
45
54
|
url: url,
|
|
46
55
|
method: method.toUpperCase(),
|
|
47
56
|
data: payload,
|
|
57
|
+
headers: { currency: axios.defaults.headers.common.currency },
|
|
48
58
|
async: false,
|
|
49
59
|
success: function ({data}) {
|
|
50
60
|
return resolve(data);
|