MCPcopy Create free account
hub / github.com/awkweb/react-supabase / useSignIn

Function useSignIn

src/hooks/auth/use-signin.ts:32–54  ·  view source on GitHub ↗
(config: UseSignInConfig = {})

Source from the content-addressed store, hash-verified

30}
31
32export function useSignIn(config: UseSignInConfig = {}): UseSignInResponse {
33 const client = useClient()
34 const [state, setState] = useState<UseSignInState>(initialState)
35
36 const execute = useCallback(
37 async (credentials: UserCredentials, options?: UseSignInOptions) => {
38 setState({ ...initialState, fetching: true })
39 const { error, session, user } = await client.auth.signIn(
40 {
41 provider: config.provider,
42 ...credentials,
43 },
44 options ?? config.options,
45 )
46 const res = { error, session, user }
47 setState({ ...res, fetching: false })
48 return res
49 },
50 [client, config],
51 )
52
53 return [state, execute]
54}

Callers 1

Calls 1

useClientFunction · 0.90

Tested by

no test coverage detected