mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-19 11:26:48 +02:00
Fix sorting fails when service is null - Closes #438
This commit is contained in:
parent
23a0ae31e5
commit
11db01e889
14
resources/js/stores/twofaccounts.js
vendored
14
resources/js/stores/twofaccounts.js
vendored
@ -196,11 +196,14 @@ export const useTwofaccounts = defineStore({
|
||||
*/
|
||||
sortAsc() {
|
||||
this.items.sort(function(a, b) {
|
||||
const serviceA = a.service ?? ''
|
||||
const serviceB = b.service ?? ''
|
||||
|
||||
if (useUserStore().preferences.sortCaseSensitive) {
|
||||
return a.service.normalize("NFD").replace(/[\u0300-\u036f]/g, "") > b.service.normalize("NFD").replace(/[\u0300-\u036f]/g, "") ? 1 : -1
|
||||
return serviceA.normalize("NFD").replace(/[\u0300-\u036f]/g, "") > serviceB.normalize("NFD").replace(/[\u0300-\u036f]/g, "") ? 1 : -1
|
||||
}
|
||||
|
||||
return a.service.localeCompare(b.service, useUserStore().preferences.lang)
|
||||
return serviceA.localeCompare(serviceB, useUserStore().preferences.lang)
|
||||
});
|
||||
|
||||
this.saveOrder()
|
||||
@ -211,11 +214,14 @@ export const useTwofaccounts = defineStore({
|
||||
*/
|
||||
sortDesc() {
|
||||
this.items.sort(function(a, b) {
|
||||
const serviceA = a.service ?? ''
|
||||
const serviceB = b.service ?? ''
|
||||
|
||||
if (useUserStore().preferences.sortCaseSensitive) {
|
||||
return a.service.normalize("NFD").replace(/[\u0300-\u036f]/g, "") < b.service.normalize("NFD").replace(/[\u0300-\u036f]/g, "") ? 1 : -1
|
||||
return serviceA.normalize("NFD").replace(/[\u0300-\u036f]/g, "") < serviceB.normalize("NFD").replace(/[\u0300-\u036f]/g, "") ? 1 : -1
|
||||
}
|
||||
|
||||
return b.service.localeCompare(a.service, useUserStore().preferences.lang)
|
||||
return serviceB.localeCompare(serviceA, useUserStore().preferences.lang)
|
||||
});
|
||||
|
||||
this.saveOrder()
|
||||
|
Loading…
x
Reference in New Issue
Block a user