MCPcopy Create free account
hub / github.com/alanagoyal/docbase / signInWithEmail

Function signInWithEmail

components/magic-link.tsx:30–57  ·  view source on GitHub ↗
(email: string)

Source from the content-addressed store, hash-verified

28 };
29
30 async function signInWithEmail(email: string) {
31 setIsLoading(true)
32 const redirectUrl =
33 redirect === "sharing"
34 ? window.location.href
35 : window.location.origin + redirect
36
37 const { data, error } = await supabase.auth.signInWithOtp({
38 email: email,
39 options: {
40 shouldCreateUser: true,
41 emailRedirectTo: redirectUrl,
42 },
43 })
44 setIsLoading(false)
45 setEmail("")
46 if (error) {
47 toast({
48 title: "Failed to send magic link",
49 description: error.message,
50 })
51 } else {
52 toast({
53 title: "Magic link sent to " + email,
54 description: "Please click the link in your email to continue",
55 })
56 }
57 }
58
59 return (
60 <>

Callers 2

handleKeyPressFunction · 0.85
MagicLinkFunction · 0.85

Calls 1

toastFunction · 0.90

Tested by

no test coverage detected