Refactoring
This commit is contained in:
10
src/App.js
10
src/App.js
@@ -5,6 +5,7 @@ import Configuration from './containers/Configuration/Configuration';
|
||||
import {connect} from 'react-redux';
|
||||
import DependencyList from './components/DependencyList/DependencyList';
|
||||
import DownloadProgress from './components/DownloadProgress/DownloadProgress';
|
||||
import {extractFileNameFromURL} from './utils';
|
||||
import ErrorDetails from './components/ErrorDetails/ErrorDetails';
|
||||
import Grid from './components/UI/Grid/Grid';
|
||||
import IPCContainer from './containers/IPCContainer/IPCContainer';
|
||||
@@ -93,11 +94,6 @@ class App extends IPCContainer {
|
||||
}
|
||||
};
|
||||
|
||||
extractFileNameFromURL = url => {
|
||||
const parts = url.split('/');
|
||||
return parts[parts.length - 1];
|
||||
};
|
||||
|
||||
getSelectedVersion = () => {
|
||||
return (this.props.ReleaseVersion === -1) ?
|
||||
'unavailable' :
|
||||
@@ -105,7 +101,7 @@ class App extends IPCContainer {
|
||||
};
|
||||
|
||||
handleDownloadDependency = url => {
|
||||
this.props.downloadItem(this.extractFileNameFromURL(url), Constants.INSTALL_TYPES.Dependency, url, this.onDownloadFileComplete);
|
||||
this.props.downloadItem(extractFileNameFromURL(url), Constants.INSTALL_TYPES.Dependency, url, this.onDownloadFileComplete);
|
||||
};
|
||||
|
||||
handleDownloadRelease = () => {
|
||||
@@ -116,7 +112,7 @@ class App extends IPCContainer {
|
||||
|
||||
handleDownloadUpgrade = () => {
|
||||
const url = this.props.UpgradeData.urls[0];
|
||||
const name = this.props.Platform === 'win32' ? 'upgrade.exe' : this.extractFileNameFromURL(url);
|
||||
const name = this.props.Platform === 'win32' ? 'upgrade.exe' : extractFileNameFromURL(url);
|
||||
this.props.downloadItem(name, Constants.INSTALL_TYPES.Upgrade, url, this.onDownloadFileComplete);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user