PageSourceSearch

https://lexore.ai/assets/SetupAuthHook-CNJ-TzDM.js

js lexore.ai collected 2026-10-05 12:10:11 UTC 3,110 bytes, 1 lines download raw bytes

1import{r as l,j as e}from"./react-vendor-BvbMP1YH.js";import{B as u,L as h,s as x,z as n}from"./index-C0Lc_zJK.js";import{C as c,a as p,b as j,c as f,d}from"./card-ZOaw5TTB.js";import{A as g}from"./AdminLayout-bIURHUva.js";import{C as N}from"./circle-alert-CI_uJxx_.js";import{C as b}from"./circle-check-D9y5jU0a.js";import"./radix-DczJy1ss.js";import"./supabase-BRLmpgyC.js";import"./charts-Debx4V90.js";import"./router-BfdCJaCf.js";import"./users-BtWqn-Ra.js";import"./activity-Do1UfVze.js";import"./mail-yBqEyEkb.js";import"./file-text-D5dwHni9.js";import"./trash-2-CjcuGI2U.js";const z=()=>{const[a,i]=l.useState(!1),[s,r]=l.useState(null),m=async()=>{i(!0),r(null);try{const{data:t,error:o}=await x.functions.invoke("setup-auth-hook",{body:{}});if(o)throw o;r(t),n.success("Auth hook configured successfully!")}catch(t){console.error("Error setting up auth hook:",t),n.error(t.message||"Failed to setup auth hook"),r({error:t.message})}finally{i(!1)}};return e.jsx(g,{children:e.jsxs("div",{className:"container mx-auto py-8 max-w-5xl",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Auth Hook Setup"}),e.jsx("p",{className:"text-muted-foreground",children:"Configure authentication email routing"})]}),e.jsxs(c,{children:[e.jsxs(p,{children:[e.jsx(j,{children:"Setup Authentication Email Hook"}),e.jsx(f,{children:"Configure Supabase to route all authentication emails through your custom Resend-powered edge function."})]}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-semibold",children:"This will:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-sm text-muted-foreground",children:[e.jsx("li",{children:"Disable Supabase's default email templates"}),e.jsx("li",{children:"Register the send-auth-email hook for all auth events"}),e.jsx("li",{children:"Route signup, verification, and password reset emails to Resend"}),e.jsx("li",{children:"Enable logging to the email_logs table"})]})]}),e.jsx(u,{onClick:m,disabled:a,width:"full",children:a?e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"mr-2 h-4 w-4 animate-spin"}),"Setting up..."]}):"Setup Auth Hook"}),s&&e.jsx(c,{className:s.error?"border-destructive":"border-green-500",children:e.jsx(d,{className:"pt-6",children:s.error?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(N,{className:"h-5 w-5 text-destructive mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-destructive",children:"Error"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.error})]})]}):e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(b,{className:"h-5 w-5 text-green-500 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-semibold text-green-500",children:"Success!"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:s.message}),e.jsx("div",{className:"text-xs bg-muted p-3 rounded-md overflow-auto",children:e.jsx("pre",{children:JSON.stringify(s,null,2)})})]})]})})})]})]})]})})};export{z as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.