fix: correct API URL for individual mark-read
The JavaScript was POSTing to /microsub/reader but the Microsub API is at /microsub. Fixed by computing parent path from baseUrl. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@rmdes/indiekit-endpoint-microsub",
|
"name": "@rmdes/indiekit-endpoint-microsub",
|
||||||
"version": "1.0.17",
|
"version": "1.0.18",
|
||||||
"description": "Microsub endpoint for Indiekit. Enables subscribing to feeds and reading content using the Microsub protocol.",
|
"description": "Microsub endpoint for Indiekit. Enables subscribing to feeds and reading content using the Microsub protocol.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"indiekit",
|
"indiekit",
|
||||||
|
|||||||
+4
-1
@@ -119,6 +119,9 @@
|
|||||||
|
|
||||||
// Handle individual mark-read buttons
|
// Handle individual mark-read buttons
|
||||||
const channelUid = timeline.dataset.channel;
|
const channelUid = timeline.dataset.channel;
|
||||||
|
// Microsub API is at the parent of /reader (e.g., /microsub not /microsub/reader)
|
||||||
|
const microsubApiUrl = '{{ baseUrl }}'.replace(/\/reader$/, '');
|
||||||
|
|
||||||
timeline.addEventListener('click', async (e) => {
|
timeline.addEventListener('click', async (e) => {
|
||||||
const button = e.target.closest('.item-actions__mark-read');
|
const button = e.target.closest('.item-actions__mark-read');
|
||||||
if (!button) return;
|
if (!button) return;
|
||||||
@@ -139,7 +142,7 @@
|
|||||||
formData.append('channel', channelUid);
|
formData.append('channel', channelUid);
|
||||||
formData.append('entry', itemId);
|
formData.append('entry', itemId);
|
||||||
|
|
||||||
const response = await fetch('{{ baseUrl }}', {
|
const response = await fetch(microsubApiUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
|||||||
Reference in New Issue
Block a user