refactor: avoid directly importing all methods from ~/utils

This commit is contained in:
Hakadao
2023-04-13 02:02:06 +08:00
parent b1ccf3e6fc
commit 495c9b460a
18 changed files with 28 additions and 36 deletions

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import type { Ref } from 'vue'
import { grantAccessKey, revokeAccessKey } from '~/utils/index'
import { grantAccessKey, revokeAccessKey } from '~/utils/authProvider'
import { accessKey, settings } from '~/logic'
const emit = defineEmits(['close'])

View File

@@ -3,7 +3,7 @@ import type { Ref, UnwrapNestedRefs } from 'vue'
import { Transition, onMounted, watch } from 'vue'
import type { UnReadDm, UnReadMessage, UserInfo } from './types'
import { updateInterval } from './notify'
import { getUserID } from '~/utils'
import { getUserID } from '~/utils/main'
interface Props {
showSearchBar: boolean

View File

@@ -2,7 +2,8 @@
import type { Ref } from 'vue'
import { TransitionGroup, onMounted, reactive, ref, watch } from 'vue'
import type { FavoriteCategory, FavoriteResource } from './types'
import { calcCurrentTime, getUserID, removeHttpFromUrl } from '~/utils'
import { getUserID, removeHttpFromUrl } from '~/utils/main'
import { calcCurrentTime } from '~/utils/dataFormatter'
const favoriteCategories = reactive<Array<FavoriteCategory>>([])
const favoriteResources = reactive<Array<FavoriteResource>>([])

View File

@@ -5,7 +5,8 @@ import { onMounted, reactive, ref, watch } from 'vue'
import { useDateFormat } from '@vueuse/core'
import type { HistoryItem } from './types'
import { HistoryType } from './types'
import { calcCurrentTime, removeHttpFromUrl } from '~/utils'
import { removeHttpFromUrl } from '~/utils/main'
import { calcCurrentTime } from '~/utils/dataFormatter'
const { t } = useI18n()
const historys = reactive<Array<HistoryItem>>([])

View File

@@ -5,7 +5,8 @@ import { onMounted, reactive, ref, watch } from 'vue'
import { isNewArticle, isNewVideo, setLastestOffsetID } from './notify'
import { MomentType } from './types'
import type { MomentItem } from './types'
import { calcTimeSince, getUserID } from '~/utils'
import { getUserID } from '~/utils/main'
import { calcTimeSince } from '~/utils/dataFormatter'
const { t } = useI18n()
const moments = reactive<Array<MomentItem>>([]) as UnwrapNestedRefs<

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import { getUserID } from '~/utils'
import { getUserID } from '~/utils/main'
const { t } = useI18n()

View File

@@ -1,7 +1,8 @@
<script lang="ts">
import { defineComponent } from 'vue'
import { revokeAccessKey } from '../../utils/index'
import { getCSRF, getUserID, numFormatter } from '~/utils'
import { revokeAccessKey } from '~/utils/authProvider'
import { getCSRF, getUserID } from '~/utils/main'
import { numFormatter } from '~/utils/dataFormatter'
export default defineComponent({
props: {
userInfo: {

View File

@@ -1,5 +1,5 @@
import { MomentType } from './types'
import { getCookie, getUserID, setCookie } from '~/utils'
import { getCookie, getUserID, setCookie } from '~/utils/main'
/** Update the time interval of topbar notifications and moments counts */
export const updateInterval = 1000 * 60 * 5 // Updated every 5 minutes

View File

@@ -1,13 +1,6 @@
<script lang="ts" setup>
import type { Ref } from 'vue'
// import { accessKey, language } from '~/logic/index'
import {
calcCurrentTime,
calcTimeSince,
numFormatter,
removeHttpFromUrl,
} from '~/utils'
// import { LanguageType } from '~/enums/appEnums'
import { removeHttpFromUrl } from '~/utils/main'
import { calcCurrentTime, calcTimeSince, numFormatter } from '~/utils/dataFormatter'
const props = defineProps<{
duration: number