mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 06:43:51 +02:00
Fix bugs with switching accounts
This commit is contained in:
@@ -76,18 +76,19 @@ const friendReq = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {{ userId: string }} params
|
* currentUserId for own reference
|
||||||
* @returns {Promise<{json: any, params: { userId: string }}>}
|
* @param {{ userId: string, currentUserId: string }} params
|
||||||
|
* @returns {Promise<{json: any, params: { userId: string, currentUserId: string }}>}
|
||||||
*/
|
*/
|
||||||
getFriendStatus(params) {
|
getFriendStatus(params) {
|
||||||
return request(`user/${params.userId}/friendStatus`, {
|
return request(`user/${params.userId}/friendStatus`, {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}).then((json) => {
|
}).then((json) => {
|
||||||
console.log('getFriendStatus', json);
|
|
||||||
const args = {
|
const args = {
|
||||||
json,
|
json,
|
||||||
params
|
params
|
||||||
};
|
};
|
||||||
|
console.log('getFriendStatus', args);
|
||||||
return args;
|
return args;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -823,7 +823,7 @@ export const useAuthStore = defineStore('Auth', () => {
|
|||||||
'Primary password is enabled, this disables auto login.'
|
'Primary password is enabled, this disables auto login.'
|
||||||
);
|
);
|
||||||
state.attemptingAutoLogin = false;
|
state.attemptingAutoLogin = false;
|
||||||
logout();
|
handleLogoutEvent();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const attemptsInLastHour = Array.from(state.autoLoginAttempts).filter(
|
const attemptsInLastHour = Array.from(state.autoLoginAttempts).filter(
|
||||||
@@ -834,7 +834,7 @@ export const useAuthStore = defineStore('Auth', () => {
|
|||||||
'More than 3 auto login attempts within the past hour, logging out instead of attempting auto login.'
|
'More than 3 auto login attempts within the past hour, logging out instead of attempting auto login.'
|
||||||
);
|
);
|
||||||
state.attemptingAutoLogin = false;
|
state.attemptingAutoLogin = false;
|
||||||
logout();
|
handleLogoutEvent();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.autoLoginAttempts.add(new Date().getTime());
|
state.autoLoginAttempts.add(new Date().getTime());
|
||||||
|
|||||||
@@ -270,6 +270,8 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
(isLoggedIn) => {
|
(isLoggedIn) => {
|
||||||
state.friends.clear();
|
state.friends.clear();
|
||||||
state.friendNumber = 0;
|
state.friendNumber = 0;
|
||||||
|
state.friendLog.clear();
|
||||||
|
state.friendLogTable.data = [];
|
||||||
groupStore.groupInstances = [];
|
groupStore.groupInstances = [];
|
||||||
state.vipFriends_ = [];
|
state.vipFriends_ = [];
|
||||||
state.onlineFriends_ = [];
|
state.onlineFriends_ = [];
|
||||||
@@ -1128,9 +1130,14 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
}
|
}
|
||||||
friendRequest
|
friendRequest
|
||||||
.getFriendStatus({
|
.getFriendStatus({
|
||||||
userId: id
|
userId: id,
|
||||||
|
currentUserId: userStore.currentUser.id
|
||||||
})
|
})
|
||||||
.then((args) => {
|
.then((args) => {
|
||||||
|
if (args.params.currentUserId !== userStore.currentUser.id) {
|
||||||
|
// safety check for delayed response
|
||||||
|
return;
|
||||||
|
}
|
||||||
handleFriendStatus(args);
|
handleFriendStatus(args);
|
||||||
if (args.json.isFriend && !state.friendLog.has(id)) {
|
if (args.json.isFriend && !state.friendLog.has(id)) {
|
||||||
if (state.friendNumber === 0) {
|
if (state.friendNumber === 0) {
|
||||||
@@ -1207,9 +1214,14 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
}
|
}
|
||||||
friendRequest
|
friendRequest
|
||||||
.getFriendStatus({
|
.getFriendStatus({
|
||||||
userId: id
|
userId: id,
|
||||||
|
currentUserId: userStore.currentUser.id
|
||||||
})
|
})
|
||||||
.then((args) => {
|
.then((args) => {
|
||||||
|
if (args.params.currentUserId !== userStore.currentUser.id) {
|
||||||
|
// safety check for delayed response
|
||||||
|
return;
|
||||||
|
}
|
||||||
handleFriendStatus(args);
|
handleFriendStatus(args);
|
||||||
if (!args.json.isFriend && state.friendLog.has(id)) {
|
if (!args.json.isFriend && state.friendLog.has(id)) {
|
||||||
const friendLogHistory = {
|
const friendLogHistory = {
|
||||||
|
|||||||
Reference in New Issue
Block a user