Fix vite version, useClient > getClient
Some checks failed
Some checks failed
This commit is contained in:
@ -160,7 +160,7 @@
|
||||
"tslib": "^2.8.1",
|
||||
"type-fest": "^5.4.4",
|
||||
"typescript": "5.9.3",
|
||||
"vite": "^7.3.1",
|
||||
"vite": "^8.0.0",
|
||||
"vite-plugin-compile-time": "^0.4.6",
|
||||
"vite-plugin-html": "^3.2.2",
|
||||
"vite-plugin-pwa": "^1.2.0",
|
||||
|
||||
@ -1,17 +1,18 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import * as v from 'valibot';
|
||||
|
||||
import { getClient } from '@/api';
|
||||
import { useClient } from '@/hooks/use-client';
|
||||
import { useFrontendConfig } from '@/hooks/use-frontend-config';
|
||||
import { patronInstanceSchema } from '@/schemas/patron';
|
||||
|
||||
const usePatronInstance = () => {
|
||||
const client = useClient();
|
||||
const frontendConfig = useFrontendConfig();
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['patron', 'instance'],
|
||||
queryFn: async () => {
|
||||
const response = await getClient().request('/api/patron/v1/instance');
|
||||
const response = await client.request('/api/patron/v1/instance');
|
||||
return v.parse(patronInstanceSchema, response.json);
|
||||
},
|
||||
enabled: frontendConfig.patron.enabled,
|
||||
|
||||
@ -1,19 +1,18 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import * as v from 'valibot';
|
||||
|
||||
import { getClient } from '@/api';
|
||||
import { useClient } from '@/hooks/use-client';
|
||||
import { useFrontendConfig } from '@/hooks/use-frontend-config';
|
||||
import { patronUserSchema } from '@/schemas/patron';
|
||||
|
||||
const usePatronUser = (url: string | undefined) => {
|
||||
const client = useClient();
|
||||
const frontendConfig = useFrontendConfig();
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['patron', 'user', url],
|
||||
queryFn: async () => {
|
||||
const response = await getClient().request(
|
||||
`/api/patron/v1/accounts/${encodeURIComponent(url!)}`,
|
||||
);
|
||||
const response = await client.request(`/api/patron/v1/accounts/${encodeURIComponent(url!)}`);
|
||||
return v.parse(patronUserSchema, response.json);
|
||||
},
|
||||
enabled: frontendConfig.patron.enabled && !!url,
|
||||
|
||||
Reference in New Issue
Block a user