update single account pinia state
This commit is contained in:
1 parent
21fb6f616a
commit
3fe427fcc3
2 files changed
+16
-4
No files matched your search
@@ -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