mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-24 09:13:50 +02:00
refactor queryRequest
This commit is contained in:
@@ -77,7 +77,7 @@
|
||||
|
||||
import { isRealInstance, parseLocation, userImage, userStatusClass } from '../../../shared/utils';
|
||||
import { useGameStore, useLaunchStore, useLocationStore, useUserStore } from '../../../stores';
|
||||
import { instanceRequest, notificationRequest, worldRequest } from '../../../api';
|
||||
import { instanceRequest, notificationRequest, queryRequest } from '../../../api';
|
||||
import { checkCanInvite, checkCanInviteSelf } from '../../../shared/utils/invite.js';
|
||||
|
||||
import Location from '../../../components/Location.vue';
|
||||
@@ -186,7 +186,7 @@
|
||||
currentLocation = lastLocationDestination.value;
|
||||
}
|
||||
const L = parseLocation(currentLocation);
|
||||
worldRequest.getCachedWorld({ worldId: L.worldId }).then((args) => {
|
||||
queryRequest.fetch('world', { worldId: L.worldId }).then((args) => {
|
||||
notificationRequest
|
||||
.sendInvite(
|
||||
{
|
||||
|
||||
@@ -94,14 +94,12 @@ const {
|
||||
mockSendRequestInvite,
|
||||
mockSendInvite,
|
||||
mockSelfInvite,
|
||||
mockGetCachedWorld
|
||||
mockQueryFetch
|
||||
} = vi.hoisted(() => ({
|
||||
mockSendRequestInvite: vi.fn().mockResolvedValue({}),
|
||||
mockSendInvite: vi.fn().mockResolvedValue({}),
|
||||
mockSelfInvite: vi.fn().mockResolvedValue({}),
|
||||
mockGetCachedWorld: vi
|
||||
.fn()
|
||||
.mockResolvedValue({ ref: { name: 'Test World' } })
|
||||
mockQueryFetch: vi.fn().mockResolvedValue({ ref: { name: 'Test World' } })
|
||||
}));
|
||||
|
||||
vi.mock('../../../../api', () => {
|
||||
@@ -116,9 +114,7 @@ vi.mock('../../../../api', () => {
|
||||
return {
|
||||
request: p(),
|
||||
userRequest: p(),
|
||||
worldRequest: p({
|
||||
getCachedWorld: (...args) => mockGetCachedWorld(...args)
|
||||
}),
|
||||
worldRequest: p(),
|
||||
instanceRequest: p({
|
||||
selfInvite: (...args) => mockSelfInvite(...args)
|
||||
}),
|
||||
@@ -139,7 +135,10 @@ vi.mock('../../../../api', () => {
|
||||
groupRequest: p(),
|
||||
inventoryRequest: p(),
|
||||
propRequest: p(),
|
||||
imageRequest: p()
|
||||
imageRequest: p(),
|
||||
queryRequest: p({
|
||||
fetch: (...args) => mockQueryFetch(...args)
|
||||
})
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
} from '../../../stores';
|
||||
import { buildFriendRow, buildInstanceHeaderRow, buildToggleRow, estimateRowSize } from '../friendsSidebarUtils';
|
||||
import { getFriendsSortFunction, isRealInstance, userImage, userStatusClass } from '../../../shared/utils';
|
||||
import { instanceRequest, notificationRequest, userRequest, worldRequest } from '../../../api';
|
||||
import { instanceRequest, notificationRequest, queryRequest, userRequest } from '../../../api';
|
||||
import { checkCanInvite, checkCanInviteSelf } from '../../../shared/utils/invite.js';
|
||||
import { getFriendsLocations } from '../../../shared/utils/location.js';
|
||||
import { parseLocation } from '../../../shared/utils';
|
||||
@@ -753,7 +753,7 @@
|
||||
currentLocation = lastLocationDestination.value;
|
||||
}
|
||||
const L = parseLocation(currentLocation);
|
||||
worldRequest.getCachedWorld({ worldId: L.worldId }).then((args) => {
|
||||
queryRequest.fetch('world', { worldId: L.worldId }).then((args) => {
|
||||
notificationRequest
|
||||
.sendInvite(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user