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:
@@ -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