11import React , { useState } from 'react' ;
2- import { inject , hooksObserver } from 'app/componentConnectors ' ;
2+ import { useOvermind } from 'app/overmind ' ;
33import { format } from 'date-fns' ;
44import { LinkButton } from 'app/components/LinkButton' ;
55
@@ -17,20 +17,24 @@ interface Props {
1717 markedAsCancelled : boolean ;
1818 cancelSubscription : ( ) => void ;
1919 updateSubscription : ( params : { coupon : string } ) => void ;
20- store : any ;
21- signals : any ;
2220}
2321
2422function ChangeSubscriptionComponent ( {
2523 date,
2624 markedAsCancelled,
2725 cancelSubscription,
2826 updateSubscription,
29- store,
30- signals,
3127} : Props ) {
32- const isLoading = store . patron . isUpdatingSubscription ;
33- const { error } = store . patron ;
28+ const {
29+ state : {
30+ patron : { isUpdatingSubscription, error } ,
31+ } ,
32+ actions : {
33+ modalOpened,
34+ patron : { tryAgainClicked } ,
35+ } ,
36+ } = useOvermind ( ) ;
37+ const isLoading = isUpdatingSubscription ;
3438
3539 const [ coupon , setCoupon ] = useState ( '' ) ;
3640
@@ -40,7 +44,7 @@ function ChangeSubscriptionComponent({
4044 There was a problem updating this subscription.
4145 < SmallText > { error } </ SmallText >
4246 < Buttons >
43- < StyledButton onClick = { ( ) => signals . patron . tryAgainClicked ( ) } >
47+ < StyledButton onClick = { ( ) => tryAgainClicked ( ) } >
4448 Try again
4549 </ StyledButton >
4650 </ Buttons >
@@ -98,7 +102,7 @@ function ChangeSubscriptionComponent({
98102 < LinkButton
99103 onClick = { e => {
100104 e . preventDefault ( ) ;
101- signals . modalOpened ( { modal : 'preferences' } ) ;
105+ modalOpened ( { modal : 'preferences' } ) ;
102106 } }
103107 >
104108 user preferences
@@ -109,6 +113,4 @@ function ChangeSubscriptionComponent({
109113 ) ;
110114}
111115
112- export const ChangeSubscription = inject ( 'signals' , 'store' ) (
113- hooksObserver ( ChangeSubscriptionComponent )
114- ) ;
116+ export const ChangeSubscription = ChangeSubscriptionComponent ;
0 commit comments