mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-18 22:33:50 +02:00
use action from store instead of directly modifying state in components
This commit is contained in:
@@ -21,7 +21,7 @@ const imageReq = {
|
||||
} catch (error) {
|
||||
console.error('Failed to cleanup avatar upload:', error);
|
||||
}
|
||||
avatarStore.avatarDialog.loading = false;
|
||||
avatarStore.setAvatarDialogLoading(false);
|
||||
},
|
||||
|
||||
async uploadAvatarImage(params, fileId) {
|
||||
@@ -154,7 +154,7 @@ const imageReq = {
|
||||
} catch (error) {
|
||||
console.error('Failed to cleanup world upload:', error);
|
||||
}
|
||||
worldStore.worldDialog.loading = false;
|
||||
worldStore.setWorldDialogLoading(false);
|
||||
},
|
||||
|
||||
async uploadWorldImage(params, fileId) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
watch(
|
||||
() => filterState.search,
|
||||
async (value) => {
|
||||
globalSearchStore.query = value;
|
||||
globalSearchStore.setQuery(value);
|
||||
|
||||
// When query < 2 chars, override the built-in filter
|
||||
// so all items (hint categories) stay visible
|
||||
|
||||
@@ -167,7 +167,7 @@ export function request(endpoint, options) {
|
||||
parsed.status === 429 &&
|
||||
init.url.endsWith('/instances/groups')
|
||||
) {
|
||||
updateLoopStore.nextGroupInstanceRefresh = 120; // 1min
|
||||
updateLoopStore.setNextGroupInstanceRefresh(120); // 1min
|
||||
$throw(429, t('api.status_code.429'), endpoint);
|
||||
}
|
||||
if (parsed.status === 504 || parsed.status === 502) {
|
||||
|
||||
@@ -564,7 +564,7 @@ function handlePipeline(args) {
|
||||
uiStore.notifyMenu('notification');
|
||||
}
|
||||
notificationStore.queueNotificationNoty(noty);
|
||||
notificationStore.notificationTable.data.push(noty);
|
||||
notificationStore.appendNotificationTableEntry(noty);
|
||||
sharedFeedStore.addEntry(noty);
|
||||
break;
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ async function saveUserMemo(id, memo) {
|
||||
} else {
|
||||
ref.$nickName = '';
|
||||
}
|
||||
userStore.userDialog.memo = memo;
|
||||
userStore.setUserDialogMemo(memo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -242,6 +242,13 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} value
|
||||
*/
|
||||
function setAvatarDialogLoading(value) {
|
||||
avatarDialog.value.loading = value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} avatarId
|
||||
@@ -800,6 +807,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
lookupAvatars,
|
||||
selectAvatarWithConfirmation,
|
||||
selectAvatarWithoutConfirmation,
|
||||
setAvatarDialogLoading,
|
||||
showAvatarAuthorDialog,
|
||||
addAvatarWearTime,
|
||||
preloadOwnAvatars
|
||||
|
||||
@@ -149,6 +149,13 @@ export const useGlobalSearchStore = defineStore('GlobalSearch', () => {
|
||||
isOpen.value = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
*/
|
||||
function setQuery(value) {
|
||||
query.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {{id: string, type: string}} item
|
||||
*/
|
||||
@@ -187,6 +194,7 @@ export const useGlobalSearchStore = defineStore('GlobalSearch', () => {
|
||||
|
||||
open,
|
||||
close,
|
||||
setQuery,
|
||||
selectResult
|
||||
};
|
||||
});
|
||||
|
||||
@@ -392,6 +392,13 @@ export const useNotificationStore = defineStore('Notification', () => {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} entry
|
||||
*/
|
||||
function appendNotificationTableEntry(entry) {
|
||||
notificationTable.value.data.push(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param notificationId
|
||||
@@ -1474,6 +1481,7 @@ export const useNotificationStore = defineStore('Notification', () => {
|
||||
isNotificationExpired,
|
||||
openNotificationLink,
|
||||
queueMarkAsSeen,
|
||||
markAllAsSeen
|
||||
markAllAsSeen,
|
||||
appendNotificationTableEntry
|
||||
};
|
||||
});
|
||||
|
||||
@@ -151,6 +151,10 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
|
||||
state.nextClearVRCXCacheCheck = value;
|
||||
}
|
||||
|
||||
function setNextGroupInstanceRefresh(value) {
|
||||
state.nextGroupInstanceRefresh = value;
|
||||
}
|
||||
|
||||
return {
|
||||
// state,
|
||||
|
||||
@@ -159,6 +163,7 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
|
||||
nextDiscordUpdate,
|
||||
ipcTimeout,
|
||||
updateLoop,
|
||||
setNextGroupInstanceRefresh,
|
||||
setNextClearVRCXCacheCheck
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1973,6 +1973,13 @@ export const useUserStore = defineStore('User', () => {
|
||||
sendBoopDialog.value.visible = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
*/
|
||||
function setUserDialogMemo(value) {
|
||||
userDialog.value.memo = value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -2018,6 +2025,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
getCurrentUser,
|
||||
handleConfig,
|
||||
showSendBoopDialog,
|
||||
setUserDialogMemo,
|
||||
checkNote,
|
||||
toggleSharedConnectionsOptOut,
|
||||
toggleDiscordFriendsOptOut
|
||||
|
||||
@@ -233,6 +233,13 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
*/
|
||||
function setProxyServer(value) {
|
||||
proxyServer.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -862,6 +869,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
|
||||
appStartAt,
|
||||
proxyServer,
|
||||
setProxyServer,
|
||||
currentlyDroppingFile,
|
||||
isRegistryBackupDialogVisible,
|
||||
ipcEnabled,
|
||||
|
||||
@@ -207,6 +207,13 @@ export const useWorldStore = defineStore('World', () => {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} value
|
||||
*/
|
||||
function setWorldDialogLoading(value) {
|
||||
worldDialog.loading = value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -316,6 +323,7 @@ export const useWorldStore = defineStore('World', () => {
|
||||
worldDialog,
|
||||
cachedWorlds,
|
||||
showWorldDialog,
|
||||
setWorldDialogLoading,
|
||||
updateVRChatWorldCache,
|
||||
applyWorld,
|
||||
preloadOwnWorlds
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
}
|
||||
|
||||
async function saveProxy() {
|
||||
vrcxStore.proxyServer = proxyServerLocal.value;
|
||||
vrcxStore.setProxyServer(proxyServerLocal.value);
|
||||
await VRCXStorage.Set('VRCX_ProxyServer', vrcxStore.proxyServer);
|
||||
await VRCXStorage.Save();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user