[Figured it out]How to run code when a dialog is s...
# help-with-umbraco
h
In Umbraco 14, I have a dialog which is opened from the action menu on a member record, when the dialog is submitted I want to run some code that sends an email to the member that is currently open. Does anyone have any similar code or hints as to where to get started. I have an existing api method ResendValidation(JObject jobj) where jobj contains the id of the member https://cdn.discordapp.com/attachments/1249681512371322962/1249681512622854164/image.png?ex=6668301a&is=6666de9a&hm=675489d62ee0ab0a61e87a3cae27be42ba4b6ad01a23f4a3ff405917f4cea9ec&
s
Would help to add a version .. 😉 Assuming v14?
h
yes, 14 😄 (added to post)
Worked out how to call my api method, now I just need to figure out how to get the Id for the member record that is currently displayed, any takers?
Bezinga!
m
@huwred how did you do it?
h
@User Which bit?
m
How to call your api
h
Copy code
await modal?.onSubmit().then(() => {
            const headers: Headers = new Headers()
            headers.set('Content-Type', 'application/json')
            headers.set('Accept', 'application/json')

            const request: RequestInfo = new Request('/sendvalidation/' + this.args.unique?.toString(), {
                method: 'GET',
                headers: headers,
            })
            // Send the request and print the response
            return fetch(request)
            .then(res => {
                console.log("got response:", res)
            })
        }).catch(() => {
            return;
        });
``this.args.unique`` is the id of the member
6 Views