@@ -21,26 +21,25 @@ const DEFAULTS = {
2121export default Component . extend ( DEFAULTS , {
2222 tagName : '' ,
2323 store : inject . service ( ) ,
24- wizard : inject . service ( ) ,
2524 formText : null ,
2625 fetchOnInit : false ,
2726 buttonText : 'Submit' ,
2827 thresholdPath : 'required' ,
2928 generateAction : false ,
3029
3130 init ( ) {
31+ this . _super ( ...arguments ) ;
3232 if ( this . get ( 'fetchOnInit' ) ) {
3333 this . attemptProgress ( ) ;
3434 }
35- if ( this . get ( 'action' ) === 'unseal' ) {
36- this . get ( 'wizard' ) . transitionTutorialMachine ( this . get ( 'wizard.currentState' ) , 'NOOP' , {
37- threshold : this . get ( 'threshold' ) ,
38- progress : this . get ( 'progress' ) ,
39- } ) ;
40- }
41- return this . _super ( ...arguments ) ;
4235 } ,
4336
37+ didInsertElement ( ) {
38+ this . _super ( ...arguments ) ;
39+ this . onUpdate ( this . getProperties ( Object . keys ( DEFAULTS ) ) ) ;
40+ } ,
41+
42+ onUpdate ( ) { } ,
4443 onShamirSuccess ( ) { } ,
4544 // can be overridden w/an attr
4645 isComplete ( data ) {
@@ -62,17 +61,23 @@ export default Component.extend(DEFAULTS, {
6261 hasProgress : computed . gt ( 'progress' , 0 ) ,
6362
6463 actionSuccess ( resp ) {
65- const { isComplete, onShamirSuccess, thresholdPath } = this . getProperties (
64+ let { onActionSuccess, isComplete, onShamirSuccess, thresholdPath } = this . getProperties (
65+ 'onActionSuccess' ,
6666 'isComplete' ,
6767 'onShamirSuccess' ,
6868 'thresholdPath'
6969 ) ;
70+ let threshold = get ( resp , thresholdPath ) ;
71+ let props = {
72+ ...resp ,
73+ threshold,
74+ } ;
7075 this . stopLoading ( ) ;
71- this . set ( 'threshold' , get ( resp , thresholdPath ) ) ;
72- this . setProperties ( resp ) ;
73- if ( isComplete ( resp ) ) {
76+ this . setProperties ( props ) ;
77+ onUpdate ( props ) ;
78+ if ( isComplete ( props ) ) {
7479 this . reset ( ) ;
75- onShamirSuccess ( resp ) ;
80+ onShamirSuccess ( props ) ;
7681 }
7782 } ,
7883
0 commit comments