Upgraded multiple dependencies across the project, including @types/node to ^22.5.1 and @supabase/supabase-js to ^2.45.3. This change also includes updates to react-related types and various other packages to their latest versions to maintain compatibility and leverage new features.
32 lines
692 B
TypeScript
32 lines
692 B
TypeScript
import type { UserAttributes } from '@supabase/supabase-js';
|
|
|
|
import { useMutation } from '@tanstack/react-query';
|
|
|
|
import { useSupabase } from './use-supabase';
|
|
|
|
type Params = UserAttributes & { redirectTo: string };
|
|
|
|
export function useUpdateUser() {
|
|
const client = useSupabase();
|
|
const mutationKey = ['supabase:user'];
|
|
|
|
const mutationFn = async (attributes: Params) => {
|
|
const { redirectTo, ...params } = attributes;
|
|
|
|
const response = await client.auth.updateUser(params, {
|
|
emailRedirectTo: redirectTo,
|
|
});
|
|
|
|
if (response.error) {
|
|
throw response.error;
|
|
}
|
|
|
|
return response.data;
|
|
};
|
|
|
|
return useMutation({
|
|
mutationKey,
|
|
mutationFn,
|
|
});
|
|
}
|