fix: Trim trailing slash in Universal Inbox URL
This commit is contained in:
@@ -72,7 +72,7 @@ export async function deleteNotification(
|
||||
if (isNotificationBuiltFromTask(notification) && notification.task) {
|
||||
await mutate(
|
||||
handleErrors(
|
||||
fetch(`${preferences.universalInboxBaseUrl}/api/tasks/${notification.task.id}`, {
|
||||
fetch(`${preferences.universalInboxBaseUrl.replace(/\/$/, "")}/api/tasks/${notification.task.id}`, {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify({ status: TaskStatus.Deleted }),
|
||||
headers: {
|
||||
@@ -93,7 +93,7 @@ export async function deleteNotification(
|
||||
} else {
|
||||
await mutate(
|
||||
handleErrors(
|
||||
fetch(`${preferences.universalInboxBaseUrl}/api/notifications/${notification.id}`, {
|
||||
fetch(`${preferences.universalInboxBaseUrl.replace(/\/$/, "")}/api/notifications/${notification.id}`, {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify({ status: NotificationStatus.Deleted }),
|
||||
headers: {
|
||||
@@ -132,7 +132,7 @@ export async function unsubscribeFromNotification(
|
||||
try {
|
||||
await mutate(
|
||||
handleErrors(
|
||||
fetch(`${preferences.universalInboxBaseUrl}/api/notifications/${notification.id}`, {
|
||||
fetch(`${preferences.universalInboxBaseUrl.replace(/\/$/, "")}/api/notifications/${notification.id}`, {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify({ status: NotificationStatus.Unsubscribed }),
|
||||
headers: {
|
||||
@@ -171,7 +171,7 @@ export async function snoozeNotification(
|
||||
const snoozeTime = computeSnoozedUntil(new Date(), 1, 6);
|
||||
await mutate(
|
||||
handleErrors(
|
||||
fetch(`${preferences.universalInboxBaseUrl}/api/notifications/${notification.id}`, {
|
||||
fetch(`${preferences.universalInboxBaseUrl.replace(/\/$/, "")}/api/notifications/${notification.id}`, {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify({ snoozed_until: snoozeTime }),
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user