All files / src/context AiHydroAuthContext.tsx

60% Statements 15/25
100% Branches 1/1
25% Functions 1/4
60% Lines 15/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50    1x                                 1x   1x 2x 2x 2x 2x 2x 2x 2x 2x     2x   1x               1x       1x      
import type { UserOrganization } from "@shared/proto/cline/account"
import type React from "react"
import { createContext, useContext } from "react"
 
// Define User type (you may need to adjust this based on your actual User type)
export interface AiHydroUser {
	uid: string
	email?: string
	displayName?: string
	photoUrl?: string
	appBaseUrl?: string
}
 
export interface AiHydroAuthContextType {
	aihydroUser: AiHydroUser | null
	organizations: UserOrganization[] | null
	activeOrganization: UserOrganization | null
}
 
export const AiHydroAuthContext = createContext<AiHydroAuthContextType | undefined>(undefined)
 
export const AiHydroAuthProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
	return (
		<AiHydroAuthContext.Provider
			value={{
				aihydroUser: null,
				organizations: null,
				activeOrganization: null,
			}}>
			{children}
		</AiHydroAuthContext.Provider>
	)
}
 
export const useAiHydroAuth = () => {
	const context = useContext(AiHydroAuthContext)
	if (context === undefined) {
		throw new Error("useAiHydroAuth must be used within a AiHydroAuthProvider")
	}
	return context
}
 
export const handleSignIn = async () => {
	console.warn("Account authorization is disabled in this build.")
}
 
export const handleSignOut = async () => {
	console.warn("Account authorization is disabled in this build.")
}