diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-03-27 22:24:09 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-03-27 22:24:09 +0300 |
commit | cf4e2f89b805b2eedd8314e9192b5267deccc96f (patch) | |
tree | 2e3395fd1250c72b2d5fa6afa5e3ada0e18adde9 /src | |
parent | 0510cd90c08185d3af983fa338b07ee789c1a037 (diff) |
Fix sorting devices without a name
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'src')
-rw-r--r-- | src/main-settings.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main-settings.js b/src/main-settings.js index 9bd0c03..59709f9 100644 --- a/src/main-settings.js +++ b/src/main-settings.js @@ -29,7 +29,16 @@ Vue.mixin(Nextcloud) const initialStateElement = document.getElementById('twofactor-u2f-initial-state') if (initialStateElement) { const devices = JSON.parse(initialStateElement.value) - devices.sort((d1, d2) => d1.name.localeCompare(d2.name)) + devices.sort() + devices.sort((d1, d2) => { + if (!d1.name) { + return 1 + } else if (!d2.name) { + return -1 + } else { + return d1.name.localeCompare(d2.name) + } + }) store.replaceState({ devices }) |