ApplePie
ApplePie

Reputation: 1185

make two vue methods synchronous

I currently have two vue methods:

(1) this.get_saved_searches()

(2) this.update_default_select_option()

How can I make method(2) only run when method(1) is finished?

Upvotes: 0

Views: 5158

Answers (1)

user10543119
user10543119

Reputation: 161

In addition to what Derek Pollard mentioned, Have both the methods return promises and use async/await to achieve what you're looking for

Sources: Promises; async/await

async bar(){
    await this.get_saved_searches();
    await this.update_default_select_option();
}

Upvotes: 2

Related Questions