PageSourceSearch

https://creatorconnect.com/assets/AdminAuthProvider-fWg4dJt6.js

js creatorconnect.com collected 2026-10-02 01:26:32 UTC 1,469 bytes, 1 lines download raw bytes

1import{j as E,d as c,p as u}from"./index-CxpclvVk.js";import{b as t}from"./vendor-react-DDV1eynV.js";import{H as y,x as d,p as m,y as A,A as b}from"./vendor-firebase-DVNX9Yd2.js";import"./vendor-stripe-CZbIad6m.js";const f=t.createContext(),k=()=>{const a=t.useContext(f);if(!a)throw new Error("useAdminAuth must be used within AdminAuthProvider");return a},q=({children:a})=>{const[g,s]=t.useState(null),[h,n]=t.useState(!1),[p,l]=t.useState(!0),[w,e]=t.useState(null);t.useEffect(()=>y(u,async i=>{if(i)try{(await d(m(c,"admins",i.uid))).exists()?(s(i),n(!0),e(null)):(s(null),n(!1),e("Access denied: Admin privileges required"))}catch(r){console.error("Error checking admin status:",r),s(null),n(!1),e("Error verifying admin status")}else s(null),n(!1),e(null);l(!1)}),[]);const x={user:g,isAdmin:h,loading:p,error:w,login:async(o,i)=>{try{l(!0),e(null);const v=(await b(u,o,i)).user;if(!(await d(m(c,"admins",v.uid))).exists())throw await A(u),new Error("Access denied: Admin privileges required");return!0}catch(r){return console.error("Login error:",r),e(r.message),!1}finally{l(!1)}},logout:async()=>{try{await A(u),s(null),n(!1),e(null)}catch(o){console.error("Logout error:",o),e(o.message)}}};return E.jsxDEV(f.Provider,{value:x,children:a},void 0,!1,{fileName:"/Users/wuwtechnologies/Desktop/ReactNativeBuildAndroid/BuildCc1/react-app/src/admin/AdminAuthProvider.jsx",lineNumber:109,columnNumber:5},void 0)};export{q as AdminAuthProvider,k as useAdminAuth};

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.