Fix splice(-1,1) removing last user when logged-in user not found
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
3db725e52c
commit
9acd722929
2 files changed
+35
-3
No files matched your search
@@ -127,7 +127,9 @@ export const useAcctMgmtStore = defineStore('acctMgmtStore', {
|
||||
const loginStore = useLoginStore();
|
||||
const loginUserData:User = loginStore.userData;
|
||||
const foundLoginUserIndex = fetchedUserList.findIndex(user => user.username === loginUserData.username);
|
||||
fetchedUserList.unshift(fetchedUserList.splice(foundLoginUserIndex, 1)[0]);
|
||||
if (foundLoginUserIndex !== -1) {
|
||||
fetchedUserList.unshift(fetchedUserList.splice(foundLoginUserIndex, 1)[0]);
|
||||
}
|
||||
return fetchedUserList;
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user