Store/Settings: Remove unnecessary `updateInvidiousInstance` call

The 'grabUserSettings' action calls the 'updateInvidiousInstance'
action whenever the database returns an empty value for this setting.

However, that scenario should never happen in the first place.
In addition, a default value is already provided directly in the state.
This commit is contained in:
Svallinn 2021-06-06 18:31:09 +01:00
parent 58bd0d1f36
commit e4d7790d6d
No known key found for this signature in database
GPG Key ID: 09FB527F34037CCA
1 changed files with 2 additions and 9 deletions

View File

@ -171,7 +171,7 @@ Object.assign(getters, {
// Custom actions // Custom actions
Object.assign(actions, { Object.assign(actions, {
// Add `grabUserSettings` to actions // Add `grabUserSettings` to actions
grabUserSettings: ({ dispatch, commit }) => { grabUserSettings: ({ commit }) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
settingsDb.find({}, (err, results) => { settingsDb.find({}, (err, results) => {
if (!err) { if (!err) {
@ -179,14 +179,7 @@ Object.assign(actions, {
results.forEach((result) => { results.forEach((result) => {
switch (result._id) { switch (result._id) {
case 'invidiousInstance': case 'invidiousInstance':
if (result.value === '') { commit('setInvidiousInstance', result.value)
dispatch(
'updateInvidiousInstance',
'https://invidious.snopyta.org'
)
} else {
commit('setInvidiousInstance', result.value)
}
break break
case 'backendFallback': case 'backendFallback':
commit('setBackendFallback', result.value) commit('setBackendFallback', result.value)