fix: use vue-query; make less useless api call
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import RankBadge from "./RankBadge.vue";
|
||||
import { animationsApiResults, polylanSubmitterApiClearCache, polylanSubmitterApiGetUserInfo } from "@/api";
|
||||
import { animationsApiResults, polylanSubmitterApiClearCache } from "@/api";
|
||||
import { queryClient, userQuery } from "@/queries";
|
||||
import { useEventPath } from "@/composables/useEventPath";
|
||||
|
||||
const { t } = useI18n();
|
||||
@@ -142,8 +143,7 @@ const clearCache = async () => {
|
||||
|
||||
const loadUserData = async () => {
|
||||
try {
|
||||
const response = await polylanSubmitterApiGetUserInfo();
|
||||
const user = response.data;
|
||||
const user = await queryClient.fetchQuery(userQuery());
|
||||
if (user?.is_authenticated) {
|
||||
userInfo.value.username = user.username ?? "";
|
||||
userInfo.value.isStaff = user.is_staff || false;
|
||||
|
||||
Reference in New Issue
Block a user