mirror of
https://github.com/gotson/komga.git
synced 2025-12-12 19:42:35 +01:00
15 lines
442 B
TypeScript
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,
|
|
})
|
|
})
|