mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 20:54:39 +03:00
webadmin: consistent pattern for client api calls wrapped in async/await
adding await in the closure. makes no functional different. but let's stick to one form.
This commit is contained in:
@ -945,7 +945,7 @@ const account = async (name: string) => {
|
||||
async function submit(e: SubmitEvent) {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
await check(fieldsetSettings, (async () => client.AccountSettingsSave(name, parseInt(maxOutgoingMessagesPerDay.value) || 0, parseInt(maxFirstTimeRecipientsPerDay.value) || 0, xparseSize(quotaMessageSize.value), firstTimeSenderDelay.checked))())
|
||||
await check(fieldsetSettings, (async () => await client.AccountSettingsSave(name, parseInt(maxOutgoingMessagesPerDay.value) || 0, parseInt(maxFirstTimeRecipientsPerDay.value) || 0, xparseSize(quotaMessageSize.value), firstTimeSenderDelay.checked))())
|
||||
},
|
||||
),
|
||||
dom.br(),
|
||||
@ -1151,7 +1151,7 @@ const domain = async (d: string) => {
|
||||
if (!window.confirm('Are you sure? A key will be generated by the server, the selector configured but disabled. The page will reload, so unsaved changes to other DKIM selectors will be lost. After adding the key, first add the selector to DNS, then enable it for signing outgoing messages.')) {
|
||||
return
|
||||
}
|
||||
await check(fieldset, (async () => client.DomainDKIMAdd(d, selector.value, algorithm.value, hash.value, canonHeader.value === 'relaxed', canonBody.value === 'relaxed', seal.checked, headers.value.split('\n').map(s => s.trim()).filter(s => s), parseDuration(lifetime.value)))())
|
||||
await check(fieldset, (async () => await client.DomainDKIMAdd(d, selector.value, algorithm.value, hash.value, canonHeader.value === 'relaxed', canonBody.value === 'relaxed', seal.checked, headers.value.split('\n').map(s => s.trim()).filter(s => s), parseDuration(lifetime.value)))())
|
||||
window.alert("Selector added. Page will be reloaded. Don't forget to add the selector to DNS, see suggested DNS records, and don't forget to enable the selector afterwards.")
|
||||
window.location.reload() // todo: reload only dkim section
|
||||
},
|
||||
@ -3244,12 +3244,12 @@ const queueList = async () => {
|
||||
|
||||
const buttonNextAttemptSet = (text: string, minutes: number) => dom.clickbutton(text, async function click(e: MouseEvent) {
|
||||
// note: awkward client call because gatherIDs() can throw an exception.
|
||||
const n = await check(e.target! as HTMLButtonElement, (async () => client.QueueNextAttemptSet(gatherIDs(), minutes))())
|
||||
const n = await check(e.target! as HTMLButtonElement, (async () => await client.QueueNextAttemptSet(gatherIDs(), minutes))())
|
||||
window.alert(''+n+' message(s) updated')
|
||||
window.location.reload() // todo: reload less
|
||||
})
|
||||
const buttonNextAttemptAdd = (text: string, minutes: number) => dom.clickbutton(text, async function click(e: MouseEvent) {
|
||||
const n = await check(e.target! as HTMLButtonElement, (async () => client.QueueNextAttemptAdd(gatherIDs(), minutes))())
|
||||
const n = await check(e.target! as HTMLButtonElement, (async () => await client.QueueNextAttemptAdd(gatherIDs(), minutes))())
|
||||
window.alert(''+n+' message(s) updated')
|
||||
window.location.reload() // todo: reload less
|
||||
})
|
||||
@ -3966,12 +3966,12 @@ const hooksList = async () => {
|
||||
|
||||
const buttonNextAttemptSet = (text: string, minutes: number) => dom.clickbutton(text, async function click(e: MouseEvent) {
|
||||
// note: awkward client call because gatherIDs() can throw an exception.
|
||||
const n = await check(e.target! as HTMLButtonElement, (async () => client.HookNextAttemptSet(gatherIDs(), minutes))())
|
||||
const n = await check(e.target! as HTMLButtonElement, (async () => await client.HookNextAttemptSet(gatherIDs(), minutes))())
|
||||
window.alert(''+n+' hook(s) updated')
|
||||
window.location.reload() // todo: reload less
|
||||
})
|
||||
const buttonNextAttemptAdd = (text: string, minutes: number) => dom.clickbutton(text, async function click(e: MouseEvent) {
|
||||
const n = await check(e.target! as HTMLButtonElement, (async () => client.HookNextAttemptAdd(gatherIDs(), minutes))())
|
||||
const n = await check(e.target! as HTMLButtonElement, (async () => await client.HookNextAttemptAdd(gatherIDs(), minutes))())
|
||||
window.alert(''+n+' hook(s) updated')
|
||||
window.location.reload() // todo: reload less
|
||||
})
|
||||
|
Reference in New Issue
Block a user