state: Use dispatch instead of direct call
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
const State = require('../lib/state')
|
|
||||||
const {dispatch} = require('../lib/dispatcher')
|
const {dispatch} = require('../lib/dispatcher')
|
||||||
const ipcRenderer = require('electron').ipcRenderer
|
const ipcRenderer = require('electron').ipcRenderer
|
||||||
|
|
||||||
@@ -56,7 +55,7 @@ module.exports = class PrefsController {
|
|||||||
ipcRenderer.send('setStartup', state.unsaved.prefs.startup)
|
ipcRenderer.send('setStartup', state.unsaved.prefs.startup)
|
||||||
}
|
}
|
||||||
state.saved.prefs = Object.assign(state.saved.prefs || {}, state.unsaved.prefs)
|
state.saved.prefs = Object.assign(state.saved.prefs || {}, state.unsaved.prefs)
|
||||||
State.save(state)
|
dispatch('saveState')
|
||||||
dispatch('checkDownloadPath')
|
dispatch('checkDownloadPath')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ const electron = require('electron')
|
|||||||
|
|
||||||
const {dispatch} = require('../lib/dispatcher')
|
const {dispatch} = require('../lib/dispatcher')
|
||||||
const {TorrentKeyNotFoundError} = require('../lib/errors')
|
const {TorrentKeyNotFoundError} = require('../lib/errors')
|
||||||
const State = require('../lib/state')
|
|
||||||
const sound = require('../lib/sound')
|
const sound = require('../lib/sound')
|
||||||
const TorrentSummary = require('../lib/torrent-summary')
|
const TorrentSummary = require('../lib/torrent-summary')
|
||||||
|
|
||||||
@@ -159,7 +158,7 @@ module.exports = class TorrentListController {
|
|||||||
|
|
||||||
// remove torrent from saved list
|
// remove torrent from saved list
|
||||||
this.state.saved.torrents.splice(index, 1)
|
this.state.saved.torrents.splice(index, 1)
|
||||||
State.saveThrottled(this.state)
|
dispatch('saveStateThrottled')
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent user from going forward to a deleted torrent
|
// prevent user from going forward to a deleted torrent
|
||||||
|
|||||||
Reference in New Issue
Block a user