Browse Source

Fetch release notes

master
Thibaut Boustany 7 years ago
parent
commit
5db25f231b
No known key found for this signature in database GPG Key ID: 32475B11A2B13EEC
  1. 23
      src/components/UpdateNotifier/UpdateInstalled.js

23
src/components/UpdateNotifier/UpdateInstalled.js

@ -2,6 +2,7 @@
import { PureComponent } from 'react'
import { connect } from 'react-redux'
import axios from 'axios'
import semver from 'semver'
import { openModal } from 'reducers/modals'
@ -28,13 +29,25 @@ const mapDispatchToProps = {
class UpdateInstalled extends PureComponent<Props> {
componentDidMount() {
const { lastUsedVersion, openModal, saveSettings } = this.props
const { lastUsedVersion, saveSettings } = this.props
const currentVersion = __APP_VERSION__
if (semver.gt(currentVersion, lastUsedVersion)) {
openModal(MODAL_RELEASES_NOTES, `${lastUsedVersion} -> ${currentVersion}`)
saveSettings({ lastUsedVersion: currentVersion })
}
// if (semver.gt(currentVersion, lastUsedVersion)) {
axios
.get(
`https://api.github.com/repos/LedgerHQ/ledger-live-desktop/releases/tags/v${currentVersion}`,
)
.then(this.showModal)
saveSettings({ lastUsedVersion: currentVersion })
// }
}
showModal = ({ data }) => {
const { openModal } = this.props
const { body } = data
openModal(MODAL_RELEASES_NOTES, body)
}
render() {

Loading…
Cancel
Save