Vue · Middle · Question 65 of 75

How do you know whether router.push() actually navigated?

const failure = await router.push('/admin')
if (isNavigationFailure(failure, NavigationFailureType.aborted)) { /* blocked by a guard */ }

Explanation

Navigation can be aborted by a guard, cancelled by a newer navigation or be duplicated; these aren't exceptions.

Further reading

Problem with a question

Vue · Middle · question 65

Test yourself

Take the Vue · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz