Code formatting
This commit is contained in:
+22
-23
@@ -1,31 +1,30 @@
|
|||||||
import { API_BASE_URL } from '../constants/api';
|
import { API_BASE_URL } from '../constants/api';
|
||||||
|
|
||||||
export const scheduleApi = {
|
export const scheduleApi = {
|
||||||
scheduleMessage: async (s, authBearerToken) => {
|
scheduleMessage: async (s, authBearerToken) => {
|
||||||
console.log('Scheduling message');
|
console.log('Scheduling message');
|
||||||
const reqBody = {
|
const reqBody = {
|
||||||
scheduled: s.scheduedTime.toISOString(),
|
scheduled: s.scheduedTime.toISOString(),
|
||||||
status: s.status,
|
status: s.status,
|
||||||
user_id: s.userId,
|
user_id: s.userId,
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(`Request body: ${reqBody}`);
|
console.log(`Request body: ${reqBody}`);
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/schedule/message`,
|
const response = await fetch(`${API_BASE_URL}/api/v1/schedule/message`, {
|
||||||
{
|
method: 'POST',
|
||||||
method: 'POST',
|
headers: {
|
||||||
headers: {
|
'Content-Type': 'application/json',
|
||||||
'Content-Type': 'application/json',
|
Authorization: authBearerToken,
|
||||||
Authorization: authBearerToken,
|
},
|
||||||
},
|
body: JSON.stringify(reqBody),
|
||||||
body: JSON.stringify(reqBody)
|
});
|
||||||
});
|
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error('Error scheduling message');
|
throw new Error('Error scheduling message');
|
||||||
} else {
|
} else {
|
||||||
return response.json();
|
return response.json();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+25
-23
@@ -1,31 +1,33 @@
|
|||||||
import { API_BASE_URL } from '../constants/api';
|
import { API_BASE_URL } from '../constants/api';
|
||||||
|
|
||||||
export const scheduleEventApi = {
|
export const scheduleEventApi = {
|
||||||
scheduleMessageEvent: async (s, authBearerToken) => {
|
scheduleMessageEvent: async (s, authBearerToken) => {
|
||||||
console.log('Scheduling message Event');
|
console.log('Scheduling message Event');
|
||||||
const reqBody = {
|
const reqBody = {
|
||||||
contact_id: s.contactId,
|
contact_id: s.contactId,
|
||||||
message_id: s.messageId,
|
message_id: s.messageId,
|
||||||
scheduled_message_id: s.scheduledMessageId,
|
scheduled_message_id: s.scheduledMessageId,
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(`Request body: ${reqBody}`);
|
console.log(`Request body: ${reqBody}`);
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/schedule/message/event`,
|
const response = await fetch(
|
||||||
{
|
`${API_BASE_URL}/api/v1/schedule/message/event`,
|
||||||
method: 'POST',
|
{
|
||||||
headers: {
|
method: 'POST',
|
||||||
'Content-Type': 'application/json',
|
headers: {
|
||||||
Authorization: authBearerToken,
|
'Content-Type': 'application/json',
|
||||||
},
|
Authorization: authBearerToken,
|
||||||
body: JSON.stringify(reqBody)
|
},
|
||||||
});
|
body: JSON.stringify(reqBody),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error('Error scheduling message event');
|
throw new Error('Error scheduling message event');
|
||||||
} else {
|
} else {
|
||||||
return response.json();
|
return response.json();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user