Cleanup
This commit is contained in:
26
packages/supabase/src/hooks/use-verify-otp.ts
Normal file
26
packages/supabase/src/hooks/use-verify-otp.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { VerifyOtpParams } from '@supabase/gotrue-js';
|
||||
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
|
||||
import { useSupabase } from './use-supabase';
|
||||
|
||||
export function useVerifyOtp() {
|
||||
const client = useSupabase();
|
||||
|
||||
const mutationKey = ['verify-otp'];
|
||||
|
||||
const mutationFn = async (params: VerifyOtpParams) => {
|
||||
const { data, error } = await client.auth.verifyOtp(params);
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
return useMutation({
|
||||
mutationFn,
|
||||
mutationKey,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user