Update test 3 #7636
2 changed files with 13 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { selectRemoteVersion } from 'redux/selectors/app';
|
||||||
import LastReleaseChanges from './view';
|
import LastReleaseChanges from './view';
|
||||||
|
|
||||||
export default LastReleaseChanges;
|
const select = (state) => ({
|
||||||
|
releaseVersion: selectRemoteVersion(state),
|
||||||
|
});
|
||||||
|
|
||||||
|
const perform = {};
|
||||||
|
|
||||||
|
export default connect(select, perform)(LastReleaseChanges);
|
||||||
|
|
|
@ -5,11 +5,12 @@ import Button from 'component/button';
|
||||||
import I18nMessage from 'component/i18nMessage';
|
import I18nMessage from 'component/i18nMessage';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
releaseVersion: string,
|
||||||
hideReleaseVersion?: boolean,
|
hideReleaseVersion?: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
const LastReleaseChanges = (props: Props) => {
|
const LastReleaseChanges = (props: Props) => {
|
||||||
const { hideReleaseVersion } = props;
|
const { hideReleaseVersion, releaseVersion } = props;
|
||||||
const [releaseTag, setReleaseTag] = useState('');
|
const [releaseTag, setReleaseTag] = useState('');
|
||||||
const [releaseChanges, setReleaseChanges] = useState('');
|
const [releaseChanges, setReleaseChanges] = useState('');
|
||||||
const [fetchingReleaseChanges, setFetchingReleaseChanges] = useState(false);
|
const [fetchingReleaseChanges, setFetchingReleaseChanges] = useState(false);
|
||||||
|
@ -35,7 +36,7 @@ const LastReleaseChanges = (props: Props) => {
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const lastReleaseUrl = 'https://api.github.com/repos/lbryio/lbry-desktop/releases/latest';
|
const lastReleaseUrl = `https://api.github.com/repos/lbryio/lbry-desktop/releases/tags/${releaseVersion}`;
|
||||||
const options = {
|
const options = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: { Accept: 'application/vnd.github.v3+json' },
|
headers: { Accept: 'application/vnd.github.v3+json' },
|
||||||
|
@ -54,7 +55,7 @@ const LastReleaseChanges = (props: Props) => {
|
||||||
setFetchingReleaseChanges(false);
|
setFetchingReleaseChanges(false);
|
||||||
setFetchReleaseFailed(true);
|
setFetchReleaseFailed(true);
|
||||||
});
|
});
|
||||||
}, []);
|
}, [releaseVersion, setFetchingReleaseChanges, setReleaseTag, setReleaseChanges, setFetchReleaseFailed]);
|
||||||
|
|
||||||
if (fetchingReleaseChanges) {
|
if (fetchingReleaseChanges) {
|
||||||
return <p>{__('Loading...')}</p>;
|
return <p>{__('Loading...')}</p>;
|
||||||
|
|
Loading…
Reference in a new issue