komga/next-ui/src/colada/queries/current-user.ts
Gauthier Roebroeck 598db5a814 announcements
2025-11-28 16:05:18 +08:00

15 lines
442 B
TypeScript

import {defineQuery, useQuery} from '@pinia/colada'
import {komgaClient} from '@/api/komga-client'
export const useCurrentUser = defineQuery(() => {
return useQuery({
key: () => ['current-user'],
query: () => komgaClient.GET('/api/v2/users/me')
// unwrap the openapi-fetch structure on success
.then((res) => res.data),
// 10 minutes
staleTime: 10 * 60 * 1000,
gcTime: false,
autoRefetch: true,
})
})