fix: 🚑️ Webhook and instant updates
This commit is contained in:
@ -27,8 +27,8 @@ const defaultFrom = {
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
await cors(req, res)
|
||||
if (req.method === 'POST') {
|
||||
const { credentialsId, recipients, body, subject, cc, bcc } = JSON.parse(
|
||||
req.body
|
||||
const { credentialsId, recipients, body, subject, cc, bcc } = (
|
||||
typeof req.body === 'string' ? JSON.parse(req.body) : req.body
|
||||
) as SendEmailOptions
|
||||
|
||||
const { host, port, isTlsEnabled, username, password, from } =
|
||||
|
@ -37,7 +37,9 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'POST') {
|
||||
const spreadsheetId = req.query.spreadsheetId.toString()
|
||||
const sheetId = req.query.sheetId.toString()
|
||||
const { credentialsId, values } = JSON.parse(req.body) as {
|
||||
const { credentialsId, values } = (
|
||||
typeof req.body === 'string' ? JSON.parse(req.body) : req.body
|
||||
) as {
|
||||
credentialsId: string
|
||||
values: { [key: string]: string }
|
||||
}
|
||||
@ -51,7 +53,9 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'PATCH') {
|
||||
const spreadsheetId = req.query.spreadsheetId.toString()
|
||||
const sheetId = req.query.sheetId.toString()
|
||||
const { credentialsId, values, referenceCell } = JSON.parse(req.body) as {
|
||||
const { credentialsId, values, referenceCell } = (
|
||||
typeof req.body === 'string' ? JSON.parse(req.body) : req.body
|
||||
) as {
|
||||
credentialsId: string
|
||||
referenceCell: Cell
|
||||
values: { [key: string]: string }
|
||||
|
Reference in New Issue
Block a user