Use release/tags endpoint to get the release details.

This commit is contained in:
Franco Montenegro 2022-06-28 11:35:53 -03:00
parent 207a1ad88c
commit 7a6ca51893
2 changed files with 13 additions and 4 deletions

View file

@ -1,3 +1,11 @@
import { connect } from 'react-redux';
import { selectRemoteVersion } from 'redux/selectors/app';
import LastReleaseChanges from './view';
export default LastReleaseChanges;
const select = (state) => ({
releaseVersion: selectRemoteVersion(state),
});
const perform = {};
export default connect(select, perform)(LastReleaseChanges);

View file

@ -5,11 +5,12 @@ import Button from 'component/button';
import I18nMessage from 'component/i18nMessage';
type Props = {
releaseVersion: string,
hideReleaseVersion?: boolean,
};
const LastReleaseChanges = (props: Props) => {
const { hideReleaseVersion } = props;
const { hideReleaseVersion, releaseVersion } = props;
const [releaseTag, setReleaseTag] = useState('');
const [releaseChanges, setReleaseChanges] = useState('');
const [fetchingReleaseChanges, setFetchingReleaseChanges] = useState(false);
@ -35,7 +36,7 @@ const LastReleaseChanges = (props: Props) => {
);
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 = {
method: 'GET',
headers: { Accept: 'application/vnd.github.v3+json' },
@ -54,7 +55,7 @@ const LastReleaseChanges = (props: Props) => {
setFetchingReleaseChanges(false);
setFetchReleaseFailed(true);
});
}, []);
}, [releaseVersion, setFetchingReleaseChanges, setReleaseTag, setReleaseChanges, setFetchReleaseFailed]);
if (fetchingReleaseChanges) {
return <p>{__('Loading...')}</p>;