From 26a94c7e8cd72811e27c1fdff672dc677d966664 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 16 Jan 2022 22:24:51 +0100 Subject: [PATCH] fix: some typechecks Most of what's still left now is related to models not exporting visible properties for typescript, that's a problem for another day. --- src/App.vue | 2 +- src/components/list/partials/list-card.vue | 7 ++++--- src/components/misc/subscription.vue | 10 +++++++--- src/components/namespace/namespace-search.vue | 3 ++- src/composables/useColorScheme.ts | 6 +++--- src/main.ts | 1 + src/views/sharing/LinkSharingAuth.vue | 12 ++++++------ 7 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/App.vue b/src/App.vue index 06a818506..5ab3635fd 100644 --- a/src/App.vue +++ b/src/App.vue @@ -42,7 +42,7 @@ import {useBodyClass} from '@/composables/useBodyClass' const store = useStore() const router = useRouter() -useBodyClass('is-touch', isTouchDevice) +useBodyClass('is-touch', isTouchDevice()) const keyboardShortcutsActive = computed(() => store.state.keyboardShortcutsActive) const authUser = computed(() => store.getters['auth/authUser']) diff --git a/src/components/list/partials/list-card.vue b/src/components/list/partials/list-card.vue index d2dce8369..17776cb81 100644 --- a/src/components/list/partials/list-card.vue +++ b/src/components/list/partials/list-card.vue @@ -28,19 +28,20 @@ diff --git a/src/composables/useColorScheme.ts b/src/composables/useColorScheme.ts index c0fed1218..f9b1cb94f 100644 --- a/src/composables/useColorScheme.ts +++ b/src/composables/useColorScheme.ts @@ -1,9 +1,9 @@ import {computed, watch, readonly} from 'vue' -import {useStorage, createSharedComposable, ColorSchema, usePreferredColorScheme, tryOnMounted} from '@vueuse/core' +import {useStorage, createSharedComposable, BasicColorSchema, usePreferredColorScheme, tryOnMounted} from '@vueuse/core' const STORAGE_KEY = 'color-scheme' -const DEFAULT_COLOR_SCHEME_SETTING: ColorSchema = 'light' +const DEFAULT_COLOR_SCHEME_SETTING: BasicColorSchema = 'light' const CLASS_DARK = 'dark' const CLASS_LIGHT = 'light' @@ -16,7 +16,7 @@ const CLASS_LIGHT = 'light' // - value is synced via `createSharedComposable` // https://github.com/vueuse/vueuse/blob/main/packages/core/useDark/index.ts export const useColorScheme = createSharedComposable(() => { - const store = useStorage(STORAGE_KEY, DEFAULT_COLOR_SCHEME_SETTING) + const store = useStorage(STORAGE_KEY, DEFAULT_COLOR_SCHEME_SETTING) const preferredColorScheme = usePreferredColorScheme() diff --git a/src/main.ts b/src/main.ts index 45108a742..ad2cbeca3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,6 +52,7 @@ app.use(Notifications) // directives import focus from '@/directives/focus' +// @ts-ignore The export does exist, ts just doesn't find it. import { VTooltip } from 'v-tooltip' import 'v-tooltip/dist/v-tooltip.css' import shortcut from '@/directives/shortcut' diff --git a/src/views/sharing/LinkSharingAuth.vue b/src/views/sharing/LinkSharingAuth.vue index 41a667394..66744930f 100644 --- a/src/views/sharing/LinkSharingAuth.vue +++ b/src/views/sharing/LinkSharingAuth.vue @@ -44,7 +44,7 @@ import Message from '@/components/misc/message.vue' const {t} = useI18n() useTitle(t('sharing.authenticating')) -async function useAuth() { +function useAuth() { const store = useStore() const route = useRoute() const router = useRouter() @@ -75,21 +75,21 @@ async function useAuth() { password: password.value, }) router.push({name: 'list.list', params: {listId}}) - } catch (e) { + } catch (e: any) { if (e.response?.data?.code === 13001) { authenticateWithPassword.value = true return } // TODO: Put this logic in a global errorMessage handler method which checks all auth codes - let errorMessage = t('sharing.error') + let err = t('sharing.error') if (e.response?.data?.message) { - errorMessage = e.response.data.message + err = e.response.data.message } if (e.response?.data?.code === 13002) { - errorMessage = t('sharing.invalidPassword') + err = t('sharing.invalidPassword') } - errorMessage.value = errorMessage + errorMessage.value = err } finally { loading.value = false }