mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 14:12:10 +01:00
- Fix 36+ biome linting issues reducing errors/warnings from 227 to 191 - Replace explicit 'any' types with proper TypeScript interfaces - Fix React hooks dependencies and useCallback patterns - Resolve unused variables and parameter assignment issues - Improve accessibility with proper label associations - Add comprehensive API documentation for admin and security features - Update README.md with accurate PostgreSQL setup and current tech stack - Create complete documentation for audit logging, CSP monitoring, and batch processing - Fix outdated project information and missing developer workflows
31 lines
550 B
TypeScript
31 lines
550 B
TypeScript
"use client";
|
|
|
|
import { createContext, type ReactNode, useContext } from "react";
|
|
|
|
interface NonceContextType {
|
|
nonce?: string;
|
|
}
|
|
|
|
const NonceContext = createContext<NonceContextType>({});
|
|
|
|
export function NonceProvider({
|
|
children,
|
|
nonce,
|
|
}: {
|
|
children: ReactNode;
|
|
nonce?: string;
|
|
}) {
|
|
return (
|
|
<NonceContext.Provider value={{ nonce }}>{children}</NonceContext.Provider>
|
|
);
|
|
}
|
|
|
|
export function useNonce() {
|
|
const context = useContext(NonceContext);
|
|
return context.nonce;
|
|
}
|
|
|
|
export function useCSPNonce() {
|
|
return useNonce();
|
|
}
|