From 4809a1eb85879779f71b548f19e099663f09fb45 Mon Sep 17 00:00:00 2001 From: wzp Date: Tue, 10 Dec 2024 12:56:00 +0800 Subject: [PATCH] pref: remove unused import --- src/components/VerifyInput.vue | 8 ++++---- src/router/index.ts | 6 ++---- src/stores/background.ts | 4 ++-- src/stores/user.ts | 2 +- src/views/UserPage.vue | 6 ++---- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/components/VerifyInput.vue b/src/components/VerifyInput.vue index 142659c..422efd3 100644 --- a/src/components/VerifyInput.vue +++ b/src/components/VerifyInput.vue @@ -6,7 +6,7 @@ @@ -84,7 +84,7 @@ async function cooldown() { } } -async function getVerifyImage() { +async function updateVerifyImage() { if (model.value.verifyImage === 'fetching' || !canRefresh.value) { return; } @@ -106,7 +106,7 @@ async function getVerifyImage() { key: key, img }; - cooldown(); + cooldown().then(); succeed = true; } catch (e) { if (e instanceof AxiosError) { diff --git a/src/router/index.ts b/src/router/index.ts index b976005..8484a17 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,8 +1,6 @@ import { useUserStore } from '@/stores'; import { type PageErrorReason, usePageStore } from '@/stores/page'; -import { IdPool, waitRef } from '@/utils'; -import { useThrottleFn } from '@vueuse/core'; -import { toRef } from 'vue'; +import { IdPool } from '@/utils'; import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'; import { RoutePermissionId } from './permissions'; @@ -90,7 +88,7 @@ router.beforeEach(async (to, from) => { case 'initializing': return false; } - if (permissionId !== undefined) { + if (permissionId) { if (userStore.hasPermission(permissionId)) { return true; } else { diff --git a/src/stores/background.ts b/src/stores/background.ts index 38e611b..d6ffb9a 100644 --- a/src/stores/background.ts +++ b/src/stores/background.ts @@ -1,5 +1,5 @@ import { defineStore } from 'pinia'; -import { reactive, readonly, ref } from 'vue'; +import { reactive, ref } from 'vue'; export type BackgroundURL = string | undefined; export type BackgroundOptions = { @@ -71,7 +71,7 @@ export const useBackgroundStore = defineStore('background', () => { } return { - taskQueue: readonly(taskQueue), + taskQueue: taskQueue, getURL, addURL, newCompId, diff --git a/src/stores/user.ts b/src/stores/user.ts index fd929a5..add09e4 100644 --- a/src/stores/user.ts +++ b/src/stores/user.ts @@ -1,6 +1,6 @@ import axiosInstance, { type RawResp } from '@/api'; import type { UserInfo } from '@/schemas'; -import { userInfoResponseSchema, type idAndNameSchema } from '@/schemas'; +import { type idAndNameSchema, userInfoResponseSchema } from '@/schemas'; import { errorMessage } from '@/utils'; import { StorageSerializers, useLocalStorage } from '@vueuse/core'; import { AxiosError } from 'axios'; diff --git a/src/views/UserPage.vue b/src/views/UserPage.vue index 5534a06..8d8f69b 100644 --- a/src/views/UserPage.vue +++ b/src/views/UserPage.vue @@ -87,10 +87,8 @@ onBeforeMount(async () => { return; } userInfo.value = userInfoResponse.data; - if (!userInfo.value.avatar) { - } - } catch (e) { - } finally { + if (!userInfo.value.avatar) { /* empty */ } + } catch (e) { /* empty */ } finally { initialized.value = true; } }