Added code to update scheduled message status
This commit is contained in:
@@ -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}}"
|
||||
}
|
||||
*
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user