From cea2d0cf42dbfd68f78d6b7b427e77ac85ae20a6 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 29 Jun 2026 15:57:40 -0400 Subject: [PATCH] Added code to update scheduled message status --- src/api/scheduleApi.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/api/scheduleApi.js b/src/api/scheduleApi.js index 140ae9c..5290b7a 100644 --- a/src/api/scheduleApi.js +++ b/src/api/scheduleApi.js @@ -25,6 +25,34 @@ export const scheduleApi = { return response.json(); } }, + + prepareMessage: async (req, authBearerToken) => { + console.log('Preparing Scheduled message'); + const reqBody = { + scheduled_message_id: req.scheduledMessageId, + status: req.status, + }; + + console.log(`Request body: ${reqBody}`); + + const response = await fetch( + `${API_BASE_URL}/api/v1/schedule/status/message/update`, + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Authorization: authBearerToken, + }, + body: JSON.stringify(reqBody), + } + ); + + if (!response.ok) { + throw new Error('Error updating status of scheduled message'); + } else { + return response.json(); + } + }, }; /* @@ -32,3 +60,13 @@ export const scheduleApi = { "status": "{{status_pending}}", "user_id": "{{user_id}}" */ + +/* + * + * + * { + "scheduled_message_id": "{{scheduled_message_id}}", + "status": "{{status_ready}}" +} + * + */