1
0
mirror of https://github.com/quay/quay.git synced 2026-01-27 18:42:52 +03:00
Files
quay/web/src/hooks/UseCreateClientKey.ts
Jonathan King 72f0a895d4 ui: Add organization and user account settings (PROJQUAY-4553) (#2151)
- This PR adds settings pages to the organization and user organization pages.
- Admin users can edit their preferences, billing, and organization type
- Updated cypress version to address bug https://github.com/cypress-io/cypress/issues/25397
2023-10-20 13:58:10 -04:00

31 lines
854 B
TypeScript

import {useMutation, useQueryClient} from '@tanstack/react-query';
import {createClientKey} from 'src/resources/UserResource';
export function useCreateClientKey({onSuccess, onError}) {
const queryClient = useQueryClient();
const createClientKeyMutator = useMutation(
async ({password}: {password: string}) => {
return createClientKey(password);
},
{
onSuccess: () => {
onSuccess();
queryClient.invalidateQueries(['user']);
queryClient.invalidateQueries(['organization']);
},
onError: (err) => {
onError(err);
},
},
);
return {
createClientKey: async (password: string) =>
createClientKeyMutator.mutate({password}),
loading: createClientKeyMutator.isLoading,
error: createClientKeyMutator.error,
clientKey: createClientKeyMutator.data,
};
}