update single account pinia state
This commit is contained in:
@@ -225,5 +225,16 @@ export default defineStore('acctMgmtStore', {
|
||||
setShouldUpdateList(shouldUpdateBoolean) {
|
||||
this.shouldUpdateList = shouldUpdateBoolean;
|
||||
},
|
||||
/** Only update one single account in the pinia state.
|
||||
* @param {object} userDataToReplace
|
||||
*/
|
||||
updateSingleAccountPiniaState(userDataToReplace){
|
||||
const userIndex = this.allUserAccoutList.findIndex(user => user.username === userDataToReplace.username);
|
||||
if (userIndex !== -1) {
|
||||
this.allUserAccoutList[userIndex] = { ...this.allUserAccoutList[userIndex], ...userDataToReplace };
|
||||
} else {
|
||||
// Error handling here.
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user