trithuc-mvc-react 2.6.1 → 2.6.2
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/api/index.js +18 -9
- package/package.json +1 -1
package/api/index.js
CHANGED
|
@@ -66,15 +66,24 @@ export const getDatasFromTable = async ({ tableName, page, pageSize, data }) =>
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
export const getDataFromTable = async ({ tableName, id }) => {
|
|
69
|
-
try {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
try {
|
|
70
|
+
if (!apiUrl) {
|
|
71
|
+
const url = `${getBaseUrl()}/Admin/${tableName}/GetDetail`;
|
|
72
|
+
const res = await api.get(url, {
|
|
73
|
+
params: {
|
|
74
|
+
id
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return res.data;
|
|
78
|
+
}else{
|
|
79
|
+
const url = `${getBaseUrl()}/${apiUrl}/${tableName}/${id}`;
|
|
80
|
+
const res = await api.get(url, {
|
|
81
|
+
params: {
|
|
82
|
+
id
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return res.data;
|
|
86
|
+
}
|
|
78
87
|
} catch (error) {
|
|
79
88
|
console.error("Error fetching data:", error);
|
|
80
89
|
throw error;
|