mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-24 08:04:11 +08:00
fix(newsletter): Checkbox refreshes properly when switching accounts
This commit is contained in:
parent
ad9242a387
commit
70c3c18ca5
1 changed files with 7 additions and 4 deletions
|
@ -13,14 +13,17 @@ class NewsletterSignup extends React.Component
|
||||||
constructor: (@props) ->
|
constructor: (@props) ->
|
||||||
@state = {status: 'Pending'}
|
@state = {status: 'Pending'}
|
||||||
|
|
||||||
|
componentWillReceiveProps: (nextProps) =>
|
||||||
|
@_onGetStatus(nextProps)
|
||||||
|
|
||||||
componentDidMount: =>
|
componentDidMount: =>
|
||||||
@_onGetStatus()
|
@_onGetStatus()
|
||||||
|
|
||||||
_onGetStatus: =>
|
_onGetStatus: (props = @props) =>
|
||||||
@setState({status: 'Pending'})
|
@setState({status: 'Pending'})
|
||||||
EdgehillAPI.request
|
EdgehillAPI.request
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
path: @_path()
|
path: @_path(props)
|
||||||
success: (status) =>
|
success: (status) =>
|
||||||
if status is 'Never Subscribed'
|
if status is 'Never Subscribed'
|
||||||
@_onSubscribe()
|
@_onSubscribe()
|
||||||
|
@ -49,8 +52,8 @@ class NewsletterSignup extends React.Component
|
||||||
error: =>
|
error: =>
|
||||||
@setState({status: "Error"})
|
@setState({status: "Error"})
|
||||||
|
|
||||||
_path: =>
|
_path: (props = @props) =>
|
||||||
"/newsletter-subscription/#{encodeURIComponent(@props.emailAddress)}?name=#{encodeURIComponent(@props.name)}"
|
"/newsletter-subscription/#{encodeURIComponent(props.emailAddress)}?name=#{encodeURIComponent(props.name)}"
|
||||||
|
|
||||||
render: =>
|
render: =>
|
||||||
<Flexbox direction='row' style={textAlign: 'left', height: 'auto'}>
|
<Flexbox direction='row' style={textAlign: 'left', height: 'auto'}>
|
||||||
|
|
Loading…
Reference in a new issue