mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Send success response at once for mod download and update
This avoids browser retrying the request if download takes too long
This commit is contained in:
parent
e72b4f65ce
commit
061d6c85e8
@ -47,7 +47,10 @@ Mods.prototype.download = function (mod, cb) {
|
||||
self.emit('mods', self.mods);
|
||||
}
|
||||
self.updateMods();
|
||||
cb(err, mods);
|
||||
|
||||
if (cb) {
|
||||
cb(err, mods);
|
||||
}
|
||||
}).on('progress', function (progress) {
|
||||
var modName = progress.mod;
|
||||
|
||||
|
@ -5,13 +5,8 @@ module.exports = function (modsManager) {
|
||||
},
|
||||
|
||||
create: function(req, res){
|
||||
modsManager.download(req.body.name, function (err, mods) {
|
||||
if (err || !mods) {
|
||||
res.send(500, err);
|
||||
} else {
|
||||
res.send(mods);
|
||||
}
|
||||
});
|
||||
modsManager.download(req.body.name);
|
||||
res.send(204, {});
|
||||
},
|
||||
|
||||
show: function(req, res){
|
||||
@ -26,13 +21,8 @@ module.exports = function (modsManager) {
|
||||
},
|
||||
|
||||
update: function(req, res){
|
||||
modsManager.download(req.params.mod, function (err, mods) {
|
||||
if (err || !mods) {
|
||||
res.send(500, err);
|
||||
} else {
|
||||
res.send(mods);
|
||||
}
|
||||
});
|
||||
modsManager.download(req.params.mod);
|
||||
res.send(204, {});
|
||||
},
|
||||
|
||||
destroy: function(req, res){
|
||||
|
Loading…
Reference in New Issue
Block a user