selfhostable, read-only reddit client
16
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: Update unsubscribe function to call /unsubscribe endpoint

+14 -2
+14 -2
src/views/index.pug
··· 31 31 } 32 32 33 33 async function unsubscribe(sub) { 34 - await postSubscription(sub, false); 34 + await postUnsubscription(sub); 35 35 updateButton(sub); 36 36 } 37 37 38 - async function postSubscription(sub, subscribe) { 38 + async function postUnsubscription(sub) { 39 + const response = await fetch('/unsubscribe', { 40 + method: 'POST', 41 + headers: { 42 + 'Content-Type': 'application/json', 43 + }, 44 + body: JSON.stringify({ subreddit: sub }), 45 + }); 46 + 47 + if (!response.ok) { 48 + console.error('Failed to update unsubscription'); 49 + } 50 + } 39 51 const response = await fetch('/subscribe', { 40 52 method: 'POST', 41 53 headers: {