Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const prepareScheduleDeviceNotificationRequest = (
issueData: IssueNotificationData,
cfg: { domain: string; apiKey: string },
scheduleTime: string,
): { reqEndpoint: RequestInfo; reqBody: RequestInit } => {
const { domain, apiKey } = cfg
const { key, name, issueDate } = issueData
/**
* TODO
* Payload is hardcoded now for UK
* In the future we will need to make it more generic (for US and Australia)
*/
const payload: ScheduleDeviceNotificationPayload = {
id: uuid.fromString(key),
type: 'editions',
topic: [{ type: 'editions', name: 'uk' }],
key,
name,
date: issueDate,
sender: 'editions-backend',
}
console.log('issue Device Notification payload', payload)
const reqBody: RequestInit = {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
Accept: 'application/json',
'Content-Type': 'application/json',
export const prepareScheduleDeviceNotificationRequest = (
issueData: IssueNotificationData,
cfg: { domain: string; apiKey: string },
scheduleTime: string,
): { reqEndpoint: RequestInfo; reqBody: RequestInit } => {
const { domain, apiKey } = cfg
const { key, name, issueDate, edition } = issueData
/**
* TODO
* Payload is hardcoded now for UK
* In the future we will need to make it more generic (for US and Australia)
*/
const payload: ScheduleDeviceNotificationPayload = {
id: uuid.fromString(key),
type: 'editions',
topic: [{ type: 'editions', name: 'uk' }],
key,
name,
date: issueDate,
sender: 'editions-backend',
}
const reqBody: RequestInit = {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),