This commit is contained in:
Gauthier Roebroeck 2025-05-23 16:26:24 +08:00
parent 68a5e02204
commit b1b0fe8697
12 changed files with 44 additions and 54 deletions

View file

@ -5,9 +5,9 @@
*/
import pluginVue from 'eslint-plugin-vue'
import vueTsEslintConfig from '@vue/eslint-config-typescript'
import {defineConfigWithVueTs, vueTsConfigs} from '@vue/eslint-config-typescript'
export default [
export default defineConfigWithVueTs(
{
name: 'app/files-to-lint',
files: ['**/*.{ts,mts,tsx,vue}'],
@ -15,11 +15,11 @@ export default [
{
name: 'app/files-to-ignore',
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**', 'openapi-generator.mts'],
},
...pluginVue.configs['flat/recommended'],
...vueTsEslintConfig(),
vueTsConfigs.recommendedTypeChecked,
{
rules: {
@ -33,4 +33,4 @@ export default [
'vue/multi-word-component-names': 'off',
}
}
]
)

View file

@ -4,7 +4,7 @@ import type {paths} from '@/generated/openapi/komga'
// Middleware that throws on error, so it works with Pinia Colada
const coladaMiddleware: Middleware = {
async onResponse({response}: {response: Response}) {
onResponse({response}: {response: Response}) {
if (!response.ok)
throw new Error(`${response.url}: ${response.status} ${response.statusText}`)
// return response untouched

View file

@ -7,7 +7,7 @@ export const useLogout = defineMutation(() => {
mutation: () =>
komgaClient.POST('/api/logout'),
onSuccess: () => {
queryCache.invalidateQueries({key: ['current-user']})
void queryCache.invalidateQueries({key: ['current-user']})
},
onError: (error) => {
console.log('logout error', error)

View file

@ -7,7 +7,7 @@ export const useMarkAnnouncementsRead = defineMutation(() => {
mutation: (announcementIds: string[]) =>
komgaClient.PUT('/api/v1/announcements', {body: announcementIds}),
onSuccess: () => {
queryCache.invalidateQueries({key: ['announcements']})
void queryCache.invalidateQueries({key: ['announcements']})
},
onError: (error) => {
console.log('announcements mark read error', error)

View file

@ -11,7 +11,7 @@ export const useUpdateUser = defineMutation(() => {
body: user,
}),
onSuccess: () => {
queryCache.invalidateQueries({key: ['users']})
void queryCache.invalidateQueries({key: ['users']})
},
onError: (error) => {
console.log('update user error', error)

View file

@ -10,16 +10,6 @@
src="@/assets/logo.svg"
/>
<div class="text-center">
<div class="text-body-2">
Welcome "{{ currentUser?.email }}"
</div>
<VBtn @click="performLogout">
Logout
</VBtn>
</div>
<div class="py-4" />
<v-row>
@ -172,17 +162,6 @@
</template>
<script setup lang="ts">
import {useCurrentUser} from '@/colada/queries/current-user'
import {useLogout} from '@/colada/mutations/logout'
const {data: currentUser} = useCurrentUser()
const router = useRouter()
const {mutateAsync: logoutAsync} = useLogout()
async function performLogout() {
logoutAsync().then(() => router.push('/login'))
}
</script>
<script lang="ts">

View file

@ -57,7 +57,7 @@ const rememberMe = ref(false)
const router = useRouter()
const route = useRoute()
async function performLogin() {
function performLogin() {
const queryCache = useQueryCache()
const {mutate} = useMutation({
mutation: () =>
@ -76,9 +76,9 @@ async function performLogin() {
queryCache.setQueryData(['current-user'], data)
queryCache.cancelQueries({key: ['current-user']})
if(route.query.redirect)
router.push({path: route.query.redirect.toString()})
void router.push({path: route.query.redirect.toString()})
else
router.push('/')
void router.push('/')
},
onError: (error) => {
//TODO: handle error

View file

@ -12,7 +12,7 @@ import {useLogout} from '@/colada/mutations/logout'
const router = useRouter()
const {mutateAsync: logoutAsync} = useLogout()
async function performLogout() {
logoutAsync().then(() => router.push('/login'))
function performLogout() {
void logoutAsync().then(() => router.push('/login'))
}
</script>

View file

@ -15,13 +15,15 @@
:subtitle="subtitle"
>
<template #text>
<slot
name="text"
:proxy-model="proxyModel"
:cancel="cancel"
:save="save"
:is-pristine="isPristine"
/>
<v-form v-model="formValid">
<slot
name="text"
:proxy-model="proxyModel"
:cancel="cancel"
:save="save"
:is-pristine="isPristine"
/>
</v-form>
</template>
<template #actions>
@ -31,7 +33,7 @@
@click="close()"
/>
<v-btn
:disabled="isPristine"
:disabled="!formValid"
text="Save"
@click="save"
/>
@ -46,7 +48,9 @@
const showDialog = defineModel<boolean>('dialog', {required: false})
const record = defineModel<unknown>('record', {required: true})
interface Props {
const formValid = ref<boolean>(false)
export interface Props {
title?: string,
subtitle?: string,
maxWidth?: string | number,

View file

@ -1,5 +1,5 @@
<template>
<v-text-field />
<v-text-field :rules="rules" />
<v-text-field />
</template>
@ -7,4 +7,11 @@
import type {components} from '@/generated/openapi/komga'
const user = defineModel<components["schemas"]["UserDto"] | undefined>({required: true})
const rules = [
value => {
if (value) return true
return 'You must enter a first name.'
},
]
</script>

View file

@ -2719,7 +2719,7 @@ export interface components {
};
Author: components["schemas"]["Series"] & {
author: components["schemas"]["Is"] | components["schemas"]["IsNot"];
} & components["schemas"]["Book"];
} ;
AuthorDto: {
name: string;
role: string;
@ -2895,7 +2895,7 @@ export interface components {
};
Deleted: components["schemas"]["Series"] & {
deleted: components["schemas"]["IsFalse"] | components["schemas"]["IsTrue"];
} & components["schemas"]["Book"];
} ;
DirectoryListingDto: {
directories: components["schemas"]["PathDto"][];
files: components["schemas"]["PathDto"][];
@ -3131,7 +3131,7 @@ export interface components {
};
LibraryId: components["schemas"]["Series"] & {
libraryId: components["schemas"]["Is"] | components["schemas"]["IsNot"];
} & components["schemas"]["Book"];
} ;
/** @description Fields to update. You can omit fields you don't want to update. */
LibraryUpdateDto: {
analyzeDimensions?: boolean;
@ -3219,7 +3219,7 @@ export interface components {
};
OneShot: components["schemas"]["Series"] & {
oneShot: components["schemas"]["IsFalse"] | components["schemas"]["IsTrue"];
} & components["schemas"]["Book"];
} ;
PageAuthenticationActivityDto: {
content?: components["schemas"]["AuthenticationActivityDto"][];
empty?: boolean;
@ -3580,10 +3580,10 @@ export interface components {
};
ReadStatus: components["schemas"]["Series"] & {
readStatus: components["schemas"]["Is"] | components["schemas"]["IsNot"];
} & components["schemas"]["Book"];
} ;
ReleaseDate: components["schemas"]["Series"] & {
releaseDate: components["schemas"]["After"] | components["schemas"]["Before"] | components["schemas"]["IsInTheLast"] | components["schemas"]["IsNotInTheLast"] | components["schemas"]["IsNotNull"] | components["schemas"]["IsNull"];
} & components["schemas"]["Book"];
} ;
ReleaseDto: {
description: string;
latest: boolean;
@ -3802,7 +3802,7 @@ export interface components {
};
Tag: components["schemas"]["Series"] & {
tag: components["schemas"]["Is"] | components["schemas"]["IsNot"] | components["schemas"]["IsNotNullT"] | components["schemas"]["IsNullT"];
} & components["schemas"]["Book"];
} ;
Text: {
after?: string;
before?: string;
@ -3862,7 +3862,7 @@ export interface components {
};
Title: components["schemas"]["Series"] & {
title: components["schemas"]["BeginsWith"] | components["schemas"]["Contains"] | components["schemas"]["DoesNotBeginWith"] | components["schemas"]["DoesNotContain"] | components["schemas"]["DoesNotEndWith"] | components["schemas"]["EndsWith"] | components["schemas"]["Is"] | components["schemas"]["IsNot"];
} & components["schemas"]["Book"];
} ;
TitleSort: components["schemas"]["Series"] & {
titleSort: components["schemas"]["BeginsWith"] | components["schemas"]["Contains"] | components["schemas"]["DoesNotBeginWith"] | components["schemas"]["DoesNotContain"] | components["schemas"]["DoesNotEndWith"] | components["schemas"]["EndsWith"] | components["schemas"]["Is"] | components["schemas"]["IsNot"];
};

View file

@ -29,7 +29,7 @@ router.onError((err, to) => {
}
})
router.isReady().then(() => {
void router.isReady().then(() => {
localStorage.removeItem('vuetify:dynamic-reload')
})