Reft
Reft

Reputation: 2433

Aurelia dialog & Typescript async await - Cannot find name 'await'

I'm having problems using async await together with Aurelia Dialog. Basically I want to send away a request when the dialog is closed and currently it gives me syntax error:

Cannot find name 'await'

If I move the request outside the .WhenClosed function I dont get any syntax error and I can fire away a request.

Cannot find name 'await'

Why is it that I can't use async await inside the .whenClosed dialog and how can I overcome this?

Upvotes: 3

Views: 481

Answers (2)

Whien_Liou
Whien_Liou

Reputation: 31

Maybe you should try to use

.whenClose(async (response) => { let result_2 = await this.organisationService... })

to instead~

Upvotes: 2

Titian Cernicova-Dragomir
Titian Cernicova-Dragomir

Reputation: 249606

The arrow function you pass to to whenClosed has to be async

async response => {}

Upvotes: 5

Related Questions