mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-05 06:16:05 +02:00
refactor queryRequest
This commit is contained in:
@@ -600,7 +600,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
isFavoriteGroupLoading.value = true;
|
||||
processBulk({
|
||||
fn: favoriteRequest.getCachedFavoriteGroups,
|
||||
fn: (params) => favoriteRequest.getFavoriteGroups(params),
|
||||
N: -1,
|
||||
params: {
|
||||
n: 50,
|
||||
@@ -781,7 +781,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
let newFavoriteSortOrder = [];
|
||||
processBulk({
|
||||
fn: (params) => queryRequest.fetch('favorites', params),
|
||||
fn: (params) => favoriteRequest.getFavorites(params),
|
||||
N: -1,
|
||||
params: {
|
||||
n: 300,
|
||||
@@ -884,7 +884,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
offset: 0,
|
||||
tag
|
||||
};
|
||||
const args = await queryRequest.fetch('favoriteAvatars', params);
|
||||
const args = await favoriteRequest.getFavoriteAvatars(params);
|
||||
handleFavoriteAvatarList(args);
|
||||
}
|
||||
|
||||
@@ -893,8 +893,8 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
*/
|
||||
function refreshFavoriteItems() {
|
||||
const types = {
|
||||
world: [0, favoriteRequest.getCachedFavoriteWorlds],
|
||||
avatar: [0, favoriteRequest.getCachedFavoriteAvatars]
|
||||
world: [0, (params) => favoriteRequest.getFavoriteWorlds(params)],
|
||||
avatar: [0, (params) => favoriteRequest.getFavoriteAvatars(params)]
|
||||
};
|
||||
const tags = [];
|
||||
for (const ref of cachedFavorites.values()) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
isRealInstance,
|
||||
migrateMemos
|
||||
} from '../shared/utils';
|
||||
import { friendRequest, queryRequest, userRequest } from '../api';
|
||||
import { friendRequest, userRequest } from '../api';
|
||||
import { AppDebug } from '../service/appConfig';
|
||||
import { createFriendPresenceCoordinator } from './coordinators/friendPresenceCoordinator';
|
||||
import { createFriendRelationshipCoordinator } from './coordinators/friendRelationshipCoordinator';
|
||||
@@ -567,7 +567,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
async function fetchPage(offset) {
|
||||
const result = await executeWithBackoff(
|
||||
async () => {
|
||||
const { json } = await queryRequest.fetch('friends', {
|
||||
const { json } = await friendRequest.getFriends({
|
||||
...args,
|
||||
n: PAGE_SIZE,
|
||||
offset
|
||||
|
||||
+17
-12
@@ -9,7 +9,12 @@ import {
|
||||
getPrintLocalDate,
|
||||
openExternalLink
|
||||
} from '../shared/utils';
|
||||
import { queryRequest, vrcPlusImageRequest } from '../api';
|
||||
import {
|
||||
inventoryRequest,
|
||||
queryRequest,
|
||||
vrcPlusIconRequest,
|
||||
vrcPlusImageRequest
|
||||
} from '../api';
|
||||
import { AppDebug } from '../service/appConfig';
|
||||
import { handleImageUploadInput } from '../shared/utils/imageUpload';
|
||||
import { router } from '../plugin/router';
|
||||
@@ -157,8 +162,8 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
n: 100,
|
||||
tag: 'gallery'
|
||||
};
|
||||
queryRequest
|
||||
.fetch('galleryFiles', params)
|
||||
vrcPlusIconRequest
|
||||
.getFileList(params)
|
||||
.then((args) => handleFilesList(args))
|
||||
.catch((error) => {
|
||||
console.error('Error fetching gallery files:', error);
|
||||
@@ -177,8 +182,8 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
n: 100,
|
||||
tag: 'icon'
|
||||
};
|
||||
queryRequest
|
||||
.fetch('galleryFiles', params)
|
||||
vrcPlusIconRequest
|
||||
.getFileList(params)
|
||||
.then((args) => handleFilesList(args))
|
||||
.catch((error) => {
|
||||
console.error('Error fetching VRC Plus icons:', error);
|
||||
@@ -229,8 +234,8 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
n: 100,
|
||||
tag: 'sticker'
|
||||
};
|
||||
queryRequest
|
||||
.fetch('galleryFiles', params)
|
||||
vrcPlusIconRequest
|
||||
.getFileList(params)
|
||||
.then((args) => handleFilesList(args))
|
||||
.catch((error) => {
|
||||
console.error('Error fetching stickers:', error);
|
||||
@@ -304,7 +309,7 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
n: 100
|
||||
};
|
||||
try {
|
||||
const args = await queryRequest.fetch('prints', params);
|
||||
const args = await vrcPlusImageRequest.getPrints(params);
|
||||
args.json.sort((a, b) => {
|
||||
return (
|
||||
new Date(b.timestamp).getTime() -
|
||||
@@ -349,7 +354,7 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
* @param printId
|
||||
*/
|
||||
async function trySavePrintToFile(printId) {
|
||||
const args = await queryRequest.fetch('print', { printId });
|
||||
const args = await vrcPlusImageRequest.getPrint({ printId });
|
||||
const imageUrl = args.json?.files?.image;
|
||||
if (!imageUrl) {
|
||||
console.error('Print image URL is missing', args);
|
||||
@@ -402,8 +407,8 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
n: 100,
|
||||
tag: 'emoji'
|
||||
};
|
||||
queryRequest
|
||||
.fetch('galleryFiles', params)
|
||||
vrcPlusIconRequest
|
||||
.getFileList(params)
|
||||
.then((args) => handleFilesList(args))
|
||||
.catch((error) => {
|
||||
console.error('Error fetching emojis:', error);
|
||||
@@ -428,7 +433,7 @@ export const useGalleryStore = defineStore('Gallery', () => {
|
||||
try {
|
||||
for (let i = 0; i < 100; i++) {
|
||||
params.offset = i * params.n;
|
||||
const args = await queryRequest.fetch('inventoryItems', params);
|
||||
const args = await inventoryRequest.getInventoryItems(params);
|
||||
for (const item of args.json.data) {
|
||||
advancedSettingsStore.currentUserInventory.set(
|
||||
item.id,
|
||||
|
||||
+1
-1
@@ -417,7 +417,7 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
let total = Infinity;
|
||||
let pages = 0;
|
||||
do {
|
||||
const args = await queryRequest.fetch('groupPosts', {
|
||||
const args = await groupRequest.getGroupPosts({
|
||||
groupId: params.groupId,
|
||||
n,
|
||||
offset
|
||||
|
||||
+2
-2
@@ -868,8 +868,8 @@ export const useUserStore = defineStore('User', () => {
|
||||
}
|
||||
});
|
||||
}
|
||||
groupRequest
|
||||
.getRepresentedGroup({ userId })
|
||||
queryRequest
|
||||
.fetch('representedGroup', { userId })
|
||||
.then((args1) => {
|
||||
groupStore.handleGroupRepresented(args1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user