tsk-7: Schedule message #8

Merged
phoenix merged 10 commits from tsk-7 into main 2026-06-30 12:13:52 -04:00
Showing only changes of commit 0c02ad8a51 - Show all commits
+35
View File
@@ -0,0 +1,35 @@
import { API_BASE_URL } from '../constants/api';
export const scheduleApi = {
scheduleMessage: async (s, authBearerToken) => {
console.log('Scheduling message');
const reqBody = {
scheduled: s.scheduedTime.toISOString(),
status: s.status,
user_id: s.userId,
};
console.log(`Request body: ${reqBody}`);
const response = await fetch(`${API_BASE_URL}/api/v1/schedule/message`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: authBearerToken,
},
body: JSON.stringify(reqBody)
});
if (!response.ok) {
throw new Error('Error scheduling message');
} else {
return response.json();
}
}
};
/*
* "scheduled": "{{scheduling_time}}",
"status": "{{status_pending}}",
"user_id": "{{user_id}}"
*/