news-cms-module 1.1.0 → 1.1.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.
|
@@ -126,18 +126,9 @@ class NewsController {
|
|
|
126
126
|
error: 'news tidak ditemukan'
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
const appBaseUrl = config.baseUrl;
|
|
131
|
-
const newsPrefix = config.newsPrefix;
|
|
132
|
-
const adminPrefix = config.adminRoutePrefix;
|
|
133
|
-
|
|
134
|
-
const fullApiUrl = `${appBaseUrl}${adminPrefix}/create`;
|
|
135
|
-
const nextUrl = `${newsPrefix}${adminPrefix}/list`
|
|
136
129
|
|
|
137
130
|
res.render(path.join(__dirname, '../views/admin/update_news.ejs'), {
|
|
138
|
-
data: posts
|
|
139
|
-
apiBaseUrl: fullApiUrl,
|
|
140
|
-
nextUrl
|
|
131
|
+
data: posts
|
|
141
132
|
});
|
|
142
133
|
} catch (error) {
|
|
143
134
|
res.status(500).json({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "news-cms-module",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"express-session": "^1.18.2",
|
|
17
17
|
"express-validator": "^7.3.1",
|
|
18
18
|
"multer": "^2.0.2",
|
|
19
|
-
"mysql2": "^3.
|
|
19
|
+
"mysql2": "^3.16.0",
|
|
20
20
|
"path": "^0.12.7",
|
|
21
21
|
"sequelize": "^6.37.7"
|
|
22
22
|
}
|
|
@@ -286,7 +286,7 @@
|
|
|
286
286
|
// Kirim metadata blok sebagai string JSON (Standar multipart/form-data untuk array of objects)
|
|
287
287
|
formData.append('contentBlocks', JSON.stringify(contentBlocksData));
|
|
288
288
|
try {
|
|
289
|
-
const response = await fetch('
|
|
289
|
+
const response = await fetch('./create', {
|
|
290
290
|
method: 'POST',
|
|
291
291
|
body: formData
|
|
292
292
|
// Jangan set Header Content-Type, browser akan otomatis mengurusnya untuk FormData
|
|
@@ -297,7 +297,7 @@
|
|
|
297
297
|
|
|
298
298
|
if (response.ok && result.success) {
|
|
299
299
|
alert('Berita berhasil disimpan!');
|
|
300
|
-
window.location.href = '
|
|
300
|
+
window.location.href = './list';
|
|
301
301
|
} else {
|
|
302
302
|
alert('Gagal membuat berita: ' + (result.error || 'Terjadi kesalahan server'));
|
|
303
303
|
}
|
|
@@ -334,7 +334,7 @@
|
|
|
334
334
|
formData.append('contentBlocks', JSON.stringify(contentBlocksData));
|
|
335
335
|
|
|
336
336
|
try {
|
|
337
|
-
let url = '
|
|
337
|
+
let url = './update/' + '<%= data.id %>';
|
|
338
338
|
const response = await fetch( url, {
|
|
339
339
|
method: 'PUT',
|
|
340
340
|
body: formData
|