fix(newsletter): convert ObjectId to string in DELETE button data attributes
Root cause: MongoDB ObjectId objects were being inserted into data-id attributes as '[object Object]' instead of their string representation. Fix: Explicitly call String() on sub._id when creating data attributes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
0b807a8bc0
commit
c0bc35f2de
2 changed files with 3 additions and 3 deletions
|
|
@ -110,7 +110,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/js/admin/newsletter-management.js?v=0.1.1.newsletter-delete-fix"></script>
|
<script src="/js/admin/newsletter-management.js?v=0.1.2.objectid-to-string"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -147,8 +147,8 @@ function renderSubscribers(subscriptions) {
|
||||||
${formatDate(sub.subscribed_at)}
|
${formatDate(sub.subscribed_at)}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||||
<button class="view-details-btn text-blue-600 hover:text-blue-900 mr-3" data-id="${sub._id}">View</button>
|
<button class="view-details-btn text-blue-600 hover:text-blue-900 mr-3" data-id="${String(sub._id)}">View</button>
|
||||||
<button class="delete-subscriber-btn text-red-600 hover:text-red-900" data-id="${sub._id}" data-email="${escapeHtml(sub.email)}">Delete</button>
|
<button class="delete-subscriber-btn text-red-600 hover:text-red-900" data-id="${String(sub._id)}" data-email="${escapeHtml(sub.email)}">Delete</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
`).join('');
|
`).join('');
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue