fix: #325 move moveCurrentLoginUserToFirstRow to store
This commit is contained in:
@@ -172,19 +172,6 @@ export default {
|
||||
loginUserData.value = loginStore.userData;
|
||||
};
|
||||
|
||||
const moveCurrentLoginUserToFirstRow = () => {
|
||||
if(infiniteAcctData.value && infiniteAcctData.value.length){
|
||||
const loginUser = acctMgmtStore.allUserAccoutList.find(user => user.username === loginUserData.value.username);
|
||||
const index = infiniteAcctData.value.findIndex(user => user.username=== loginUserData.value.username);
|
||||
if(loginUser){
|
||||
infiniteAcctData.value.unshift(infiniteAcctData.value.splice(index, 1)[0]);
|
||||
console.log('第一個infiniteAcctData.value[0]', infiniteAcctData.value[0], 'loginUserData.value.username', loginUserData.value.username);
|
||||
console.log('infiniteAcctData.value[index]',infiniteAcctData.value[index] );
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const moveJustCreateUserToFirstRow = () => {
|
||||
if(infiniteAcctData.value && infiniteAcctData.value.length){
|
||||
const index = acctMgmtStore.allUserAccoutList.findIndex(user => user.username === acctMgmtStore.justCreateUsername);
|
||||
@@ -248,7 +235,6 @@ export default {
|
||||
};
|
||||
|
||||
const onEditButtonClick = userNameToEdit => {
|
||||
console.log('onEditButtonClick userNameToEdit', userNameToEdit);
|
||||
acctMgmtStore.setCurrentViewingUser(userNameToEdit);
|
||||
modalStore.openModal(MODAL_ACCT_EDIT);
|
||||
}
|
||||
@@ -269,7 +255,6 @@ export default {
|
||||
|
||||
// 當夾帶有infiniteStart.value,就表示依然考慮到無限捲動的需求
|
||||
infiniteAcctData.value = allAccountResponsive.value.slice(0, infiniteStart.value + ONCE_RENDER_NUM_OF_DATA);
|
||||
moveCurrentLoginUserToFirstRow();
|
||||
moveJustCreateUserToFirstRow();
|
||||
}
|
||||
});
|
||||
@@ -314,7 +299,6 @@ export default {
|
||||
onMounted(async () => {
|
||||
await fetchLoginUserData();
|
||||
await acctMgmtStore.getAllUserAccounts();
|
||||
moveCurrentLoginUserToFirstRow();
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -439,9 +423,6 @@ export default {
|
||||
onEditBtnClickVue2(clickedUserName){
|
||||
this.setCurrentViewingUser(clickedUserName);
|
||||
this.openModal(MODAL_ACCT_EDIT);
|
||||
},
|
||||
moveCurrentLoginUserToFirstRow(){
|
||||
|
||||
},
|
||||
...mapActions(useModalStore, ['openModal']),
|
||||
...mapActions(useAcctMgmtStore, [
|
||||
|
||||
Reference in New Issue
Block a user