mirror of
https://github.com/pockethost/pockethost.git
synced 2025-05-29 18:26:39 +00:00
mothership mail hook typings updates
This commit is contained in:
parent
fa55f98ff5
commit
35e4a79338
@ -4,22 +4,27 @@ routerAdd(
|
|||||||
'POST',
|
'POST',
|
||||||
'/api/mail',
|
'/api/mail',
|
||||||
(c) => {
|
(c) => {
|
||||||
let data = new DynamicModel({
|
const { mkLog, audit } = /** @type {Lib} */ (require(`${__hooks}/lib.js`))
|
||||||
to: '',
|
const log = mkLog(`mail`)
|
||||||
subject: '',
|
|
||||||
body: '',
|
|
||||||
})
|
|
||||||
|
|
||||||
console.log(`***before bind`)
|
let data = /** @type {{ to: string; subject: string; body: string }} */ (
|
||||||
|
new DynamicModel({
|
||||||
|
to: '',
|
||||||
|
subject: '',
|
||||||
|
body: '',
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
log(`before bind`)
|
||||||
|
|
||||||
c.bind(data)
|
c.bind(data)
|
||||||
|
|
||||||
console.log(`***after bind`)
|
log(`after bind`)
|
||||||
|
|
||||||
// This is necessary for destructuring to work correctly
|
// This is necessary for destructuring to work correctly
|
||||||
data = JSON.parse(JSON.stringify(data))
|
data = JSON.parse(JSON.stringify(data))
|
||||||
|
|
||||||
console.log(`***bind parsed`, JSON.stringify(data))
|
log(`bind parsed`, JSON.stringify(data))
|
||||||
|
|
||||||
const { to, subject, body } = data
|
const { to, subject, body } = data
|
||||||
|
|
||||||
@ -35,8 +40,8 @@ routerAdd(
|
|||||||
|
|
||||||
$app.newMailClient().send(email)
|
$app.newMailClient().send(email)
|
||||||
|
|
||||||
const msg = `***Sent to ${to}`
|
const msg = `Sent to ${to}`
|
||||||
console.log(msg)
|
log(msg)
|
||||||
|
|
||||||
return c.json(200, { status: 'ok' })
|
return c.json(200, { status: 'ok' })
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user