qumra-engine 2.0.37 → 2.0.39
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.
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.prepareDataMiddleware = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
4
8
|
const prepareDataMiddleware = (req, res, next) => {
|
|
5
9
|
const parsedUrl = res.locals.parsedUrl;
|
|
6
10
|
// ✅ تخطي الرندر في production لبعض المسارات
|
|
@@ -10,7 +14,7 @@ const prepareDataMiddleware = (req, res, next) => {
|
|
|
10
14
|
// return next();
|
|
11
15
|
// }
|
|
12
16
|
// }
|
|
13
|
-
let themePath =
|
|
17
|
+
let themePath = "";
|
|
14
18
|
if (req.session.themeId) {
|
|
15
19
|
themePath = `?themeVersionId=${req.session.themeId}`;
|
|
16
20
|
}
|
|
@@ -20,27 +24,24 @@ const prepareDataMiddleware = (req, res, next) => {
|
|
|
20
24
|
console.log(req.cookies);
|
|
21
25
|
console.log({
|
|
22
26
|
"Content-Type": "application/json",
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
qdid: req.cookies.qdid || "",
|
|
28
|
+
authorization: req.cookies.authorization || "",
|
|
25
29
|
});
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
const qdid = req.cookies.qdid || "";
|
|
31
|
+
const authorization = req.cookies.authorization || "";
|
|
32
|
+
axios_1.default
|
|
33
|
+
.post(api, { url: parsedUrl.fullUrl }, // ← body مباشرة هنا
|
|
34
|
+
{
|
|
28
35
|
headers: {
|
|
29
36
|
"Content-Type": "application/json",
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
authorization: authorization,
|
|
38
|
+
qdid: qdid,
|
|
32
39
|
},
|
|
33
|
-
body: JSON.stringify({ url: parsedUrl.fullUrl }),
|
|
34
40
|
})
|
|
35
41
|
.then((engineResponse) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return engineResponse.json();
|
|
40
|
-
})
|
|
41
|
-
.then((data) => {
|
|
42
|
-
// تم تخزين النتيجة داخل res.locals.render
|
|
43
|
-
res.locals.render = data.data;
|
|
42
|
+
// axios لا يستخدم .ok ولا .json()
|
|
43
|
+
// البيانات موجودة مباشرة في engineResponse.data
|
|
44
|
+
res.locals.render = engineResponse.data?.data;
|
|
44
45
|
next();
|
|
45
46
|
})
|
|
46
47
|
.catch((err) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qumra-engine",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.39",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"pub": "tsc && npm version patch && npm publish"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
+
"axios": "^1.10.0",
|
|
11
12
|
"chalk": "^5.4.1",
|
|
12
13
|
"colord": "^2.9.3",
|
|
13
14
|
"cookie-parser": "^1.4.7",
|