diff options
| author | hakabahitoyo <hakabahitoyo@example.com> | 2018-10-26 15:08:51 +0900 |
|---|---|---|
| committer | hakabahitoyo <hakabahitoyo@example.com> | 2018-10-26 15:08:51 +0900 |
| commit | 630c6e3e4417be8d79bf3ade011f07d78bf99b44 (patch) | |
| tree | e35e8d45e84b8da527079c4bddfc97b3547d45ec | |
| parent | 01aba3f9c6fa89106cf5b6322b7919f26e92b21d (diff) | |
simplify code
| -rw-r--r-- | src/main.js | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/main.js b/src/main.js index 53cee313..b71ae4cb 100644 --- a/src/main.js +++ b/src/main.js @@ -219,18 +219,9 @@ window.fetch('/nodeinfo/2.0.json') const metadata = data.metadata const features = metadata.features - store.dispatch('setInstanceOption', { - name: 'mediaProxyAvailable', - value: features.findIndex((element, index, array) => (element === 'media_proxy')) >= 0 - }) - store.dispatch('setInstanceOption', { - name: 'chatAvailable', - value: features.findIndex((element, index, array) => (element === 'chat')) >= 0 - }) - store.dispatch('setInstanceOption', { - name: 'gopherAvailable', - value: features.findIndex((element, index, array) => (element === 'gopher')) >= 0 - }) + store.dispatch('setInstanceOption', { name: 'mediaProxyAvailable', value: features.includes('media_proxy') }) + store.dispatch('setInstanceOption', { name: 'chatAvailable', value: features.includes('chat') }) + store.dispatch('setInstanceOption', { name: 'gopherAvailable', value: features.includes('gopher') }) const suggestions = metadata.suggestions store.dispatch('setInstanceOption', { name: 'suggestionsEnabled', value: suggestions.enabled }) |
