Created
June 23, 2021 17:07
-
-
Save th3hamburgler/365933eceb8cf84aa8f836d85d2b2562 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Route from '@ember/routing/route'; | |
import { action } from '@ember/object'; | |
export default class FormRoute extends Route { | |
@action | |
willTransition(transition) { | |
if (this.controller.userHasEnteredData && | |
!confirm('Are you sure you want to abandon progress?')) { | |
transition.abort(); | |
} else { | |
// Bubble the `willTransition` action so that | |
// parent routes can decide whether or not to abort. | |
return true; | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment