workaround for bug #91

This commit is contained in:
knoxfighter 2018-02-11 21:47:32 +01:00
parent 783696ad8e
commit ebc11ba91a
2 changed files with 25 additions and 8 deletions

View File

@ -4,7 +4,8 @@ import ModFoundOverview from './ModFoundOverview.jsx';
class ModSearch extends React.Component {
render() {
if(this.props.loggedIn) {
return (
//TODO switch back to currently commented out code, when the mod-portal-api is back with all features!!
/*return (
<div className="box-body">
<form onSubmit={this.props.submitSearchMod}>
<div className="input-group col-lg-5">
@ -19,6 +20,18 @@ class ModSearch extends React.Component {
{...this.props}
/>
</div>
)*/
return (
<div className="box-body">
<form onSubmit={this.props.loadDownloadList}>
<div className="input-group col-lg-5">
<input type="text" className="form-control" placeholder="Download mod by ID" name="modId" />
<span className="input-group-btn">
<input className="btn btn-default" type="submit" value="Go!"/>
</span>
</div>
</form>
</div>
)
} else {
return (
@ -44,7 +57,8 @@ class ModSearch extends React.Component {
ModSearch.propTypes = {
submitSearchMod: React.PropTypes.func.isRequired,
loggedIn: React.PropTypes.bool.isRequired,
submitFactorioLogin: React.PropTypes.func.isRequired
submitFactorioLogin: React.PropTypes.func.isRequired,
loadDownloadList: React.PropTypes.func.isRequired
}
export default ModSearch;

View File

@ -156,12 +156,15 @@ class ModsContent extends React.Component {
});
}
//TODO remove modIdInput, when the factorio-mod-portal-api is fixed
// all outcommented needs to be reimplemented, when it will work again
loadDownloadList(e) {
e.preventDefault();
let $button = $(e.target);
let $loader = $("<div class='loader'></div>");
$button.prepend($loader);
let modId = $button.data("modId");
// let $button = $(e.target);
// let $loader = $("<div class='loader'></div>");
// $button.prepend($loader);
let modId = $(e.target).find("input[name=modId]").val();
// let modId = $button.data("modId");
$.ajax({
method: "POST",
@ -171,7 +174,7 @@ class ModsContent extends React.Component {
},
dataType: "json",
success: (data) => {
$loader.remove();
// $loader.remove();
let correctData = JSON.parse(data.data);
@ -244,7 +247,7 @@ class ModsContent extends React.Component {
},
error: (xhr, status, err) => {
console.log('api/mods/details', status, err.toString());
$loader.remove();
// $loader.remove();
}
})
}