mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-13 16:01:34 +02:00
feat(core): Code optimization with file download
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
marked, ModalConfirmService, $stateParams, TopicsService, localStorageService, $compile, RepliesService, $filter, Upload, DownloadService,
|
||||
mtDebug) {
|
||||
var vm = this;
|
||||
vm.DLS = DownloadService
|
||||
vm.forumsConfig = MeanTorrentConfig.meanTorrentConfig.forumsConfig;
|
||||
vm.announce = MeanTorrentConfig.meanTorrentConfig.announce;
|
||||
vm.scoreConfig = MeanTorrentConfig.meanTorrentConfig.score;
|
||||
@@ -529,26 +530,5 @@
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* downloadAttach
|
||||
* @param t
|
||||
* @param r
|
||||
* @param af
|
||||
*/
|
||||
vm.downloadAttach = function (t, r, af) {
|
||||
var url = '/api/attach/' + vm.topic._id.toString();
|
||||
url += r ? '/' + r._id.toString() : '';
|
||||
url += '?attachId=' + af._id.toString();
|
||||
|
||||
DownloadService.downloadFile(url, null, function (status) {
|
||||
if (status === 200) {
|
||||
NotifycationService.showSuccessNotify('FORUMS.ATTACHE_DOWNLOAD_SUCCESSFULLY');
|
||||
}
|
||||
}, function (err) {
|
||||
mtDebug.info(err);
|
||||
NotifycationService.showErrorNotify(err.data.message, 'FORUMS.ATTACHE_DOWNLOAD_FAILED');
|
||||
});
|
||||
};
|
||||
}
|
||||
}());
|
||||
|
||||
Reference in New Issue
Block a user