1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Migrate apikeys to React (#6390)

This commit is contained in:
viown 2025-01-23 22:58:24 +03:00 committed by GitHub
parent 4e750711b7
commit fa749e4d45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 241 additions and 121 deletions

View file

@ -0,0 +1,23 @@
import { ApiKeyApiCreateKeyRequest } from '@jellyfin/sdk/lib/generated-client/api/api-key-api';
import { getApiKeyApi } from '@jellyfin/sdk/lib/utils/api/api-key-api';
import { useMutation } from '@tanstack/react-query';
import { useApi } from 'hooks/useApi';
import { queryClient } from 'utils/query/queryClient';
import { QUERY_KEY } from './useApiKeys';
export const useCreateKey = () => {
const { api } = useApi();
return useMutation({
mutationFn: (params: ApiKeyApiCreateKeyRequest) => (
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
getApiKeyApi(api!)
.createKey(params)
),
onSuccess: () => {
void queryClient.invalidateQueries({
queryKey: [ QUERY_KEY ]
});
}
});
};