use action from store instead of directly modifying state in components

This commit is contained in:
pa
2026-03-08 20:23:17 +09:00
parent b9c874bed0
commit ae0152c28e
9 changed files with 47 additions and 8 deletions
+11 -3
View File
@@ -230,7 +230,7 @@ export const useFriendStore = defineStore('Friend', () => {
state.friendNumber = 0;
friendLog.clear();
friendLogTable.value.data = [];
groupStore.groupInstances = [];
groupStore.clearGroupInstances();
onlineFriendCount.value = 0;
pendingOfflineMap.clear();
if (isLoggedIn) {
@@ -273,7 +273,7 @@ export const useFriendStore = defineStore('Friend', () => {
if (appearanceSettingsStore.randomUserColours) {
getNameColour(userStore.currentUser.id).then((colour) => {
userStore.currentUser.$userColour = colour;
userStore.setCurrentUserColour(colour);
});
}
}
@@ -1684,6 +1684,13 @@ export const useFriendStore = defineStore('Friend', () => {
}
}
/**
* @param {boolean} value
*/
function setRefreshFriendsLoading(value) {
isRefreshFriendsLoading.value = value;
}
return {
state,
@@ -1725,6 +1732,7 @@ export const useFriendStore = defineStore('Friend', () => {
updateUserCurrentStatus,
handleFriendAdd,
handleFriendDelete,
initFriendLogHistoryTable
initFriendLogHistoryTable,
setRefreshFriendsLoading
};
});