garage-erp/apps/dashboard/modules/employees/employee-context.tsx
2026-04-06 02:32:47 +03:00

29 lines
549 B
TypeScript

"use client"
import { createContext, useContext } from "react"
type EmployeeContextValue = {
id: string
label: string
}
const EmployeeContext = createContext<EmployeeContextValue | null>(null)
export function EmployeeProvider({
employee,
children,
}: {
employee: EmployeeContextValue
children: React.ReactNode
}) {
return (
<EmployeeContext.Provider value={employee}>
{children}
</EmployeeContext.Provider>
)
}
export function useEmployee() {
return useContext(EmployeeContext)
}