mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-01 04:33:46 +02:00
refactor query requests to use queryRequest module
This commit is contained in:
@@ -376,10 +376,9 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { Languages, Package, RefreshCcw, Settings, Trash2 } from 'lucide-vue-next';
|
||||
import { Languages, RefreshCcw, Trash2 } from 'lucide-vue-next';
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { ButtonGroup } from '@/components/ui/button-group';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
@@ -395,7 +394,6 @@
|
||||
useGeneralSettingsStore,
|
||||
useGroupStore,
|
||||
useInstanceStore,
|
||||
useLaunchStore,
|
||||
useNotificationsSettingsStore,
|
||||
usePhotonStore,
|
||||
useUiStore,
|
||||
@@ -405,7 +403,7 @@
|
||||
useVrcxStore,
|
||||
useWorldStore
|
||||
} from '../../../../stores';
|
||||
import { authRequest, miscRequest } from '../../../../api';
|
||||
import { authRequest, queryRequest } from '../../../../api';
|
||||
import { openExternalLink } from '../../../../shared/utils';
|
||||
|
||||
import AvatarProviderDialog from '../../dialogs/AvatarProviderDialog.vue';
|
||||
@@ -420,10 +418,9 @@
|
||||
const advancedSettingsStore = useAdvancedSettingsStore();
|
||||
const notificationsSettingsStore = useNotificationsSettingsStore();
|
||||
const { updateVRLastLocation, updateOpenVR } = useVrStore();
|
||||
const { showLaunchOptions } = useLaunchStore();
|
||||
const { enablePrimaryPasswordChange } = useAuthStore();
|
||||
const { cachedConfig } = storeToRefs(useAuthStore());
|
||||
const { clearVRCXCache, showRegistryBackupDialog } = useVrcxStore();
|
||||
const { clearVRCXCache } = useVrcxStore();
|
||||
const { showConsole } = useUiStore();
|
||||
const { disableGameLogDialog } = useGameLogStore();
|
||||
|
||||
@@ -576,7 +573,7 @@
|
||||
*
|
||||
*/
|
||||
function getVisits() {
|
||||
miscRequest.getVisits().then((args) => {
|
||||
queryRequest.fetch('visits').then((args) => {
|
||||
visits.value = args.json;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -106,8 +106,8 @@
|
||||
|
||||
import { formatDateFilter, getGroupName, replaceBioSymbols } from '../../../shared/utils';
|
||||
import { Switch } from '../../../components/ui/switch';
|
||||
import { groupRequest } from '../../../api';
|
||||
import { processBulk } from '../../../service/request';
|
||||
import { queryRequest } from '../../../api';
|
||||
import { useGroupStore } from '../../../stores';
|
||||
|
||||
import GroupCalendarEventCard from '../components/GroupCalendarEventCard.vue';
|
||||
@@ -142,6 +142,9 @@
|
||||
showFeaturedEvents.value = await configRepository.getBool('VRCX_groupCalendarShowFeaturedEvents', false);
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function toggleFeaturedEvents() {
|
||||
configRepository.setBool('VRCX_groupCalendarShowFeaturedEvents', showFeaturedEvents.value);
|
||||
updateCalenderData();
|
||||
@@ -171,6 +174,9 @@
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
async function updateCalenderData() {
|
||||
isLoading.value = true;
|
||||
let fetchPromises = [getCalendarData(), getFollowingCalendarData()];
|
||||
@@ -332,17 +338,24 @@
|
||||
// Use a stable key for calendar maps (independent of locale/appearance date formatting).
|
||||
const formatDateKey = (date) => dayjs(date).format('YYYY-MM-DD');
|
||||
|
||||
/**
|
||||
*
|
||||
* @param groupId
|
||||
*/
|
||||
async function getGroupNameFromCache(groupId) {
|
||||
if (!groupNamesCache.has(groupId)) {
|
||||
groupNamesCache.set(groupId, await getGroupName(groupId));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
async function getCalendarData() {
|
||||
calendar.value = [];
|
||||
try {
|
||||
await processBulk({
|
||||
fn: groupRequest.getGroupCalendars,
|
||||
fn: (bulkParams) => queryRequest.fetch('groupCalendars', bulkParams),
|
||||
N: -1,
|
||||
params: {
|
||||
n: 100,
|
||||
@@ -364,11 +377,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
async function getFollowingCalendarData() {
|
||||
followingCalendar.value = [];
|
||||
try {
|
||||
await processBulk({
|
||||
fn: groupRequest.getFollowingGroupCalendars,
|
||||
fn: (bulkParams) => queryRequest.fetch('followingGroupCalendars', bulkParams),
|
||||
N: -1,
|
||||
params: {
|
||||
n: 100,
|
||||
@@ -388,11 +404,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
async function getFeaturedCalendarData() {
|
||||
featuredCalendar.value = [];
|
||||
try {
|
||||
await processBulk({
|
||||
fn: groupRequest.getFeaturedGroupCalendars,
|
||||
fn: (bulkParams) => queryRequest.fetch('featuredGroupCalendars', bulkParams),
|
||||
N: -1,
|
||||
params: {
|
||||
n: 100,
|
||||
@@ -412,6 +431,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param updatedEvent
|
||||
*/
|
||||
function updateFollowingCalendarData(updatedEvent) {
|
||||
const index = followingCalendar.value.findIndex((item) => item.id === updatedEvent.id);
|
||||
if (index !== -1) {
|
||||
@@ -422,14 +445,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param eventId
|
||||
*/
|
||||
function isEventFollowing(eventId) {
|
||||
return followingCalendar.value.some((item) => item.id === eventId);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function toggleViewMode() {
|
||||
viewMode.value = viewMode.value === 'timeline' ? 'grid' : 'timeline';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param groupId
|
||||
*/
|
||||
function toggleGroup(groupId) {
|
||||
groupCollapsed.value = {
|
||||
...groupCollapsed.value,
|
||||
@@ -437,6 +471,9 @@
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function closeDialog() {
|
||||
emit('close');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user