feat: complete i18n support, telegram webhook, and security improvements
This commit is contained in:
27
components/DictionaryContext.tsx
Normal file
27
components/DictionaryContext.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
"use client";
|
||||
|
||||
import React, { createContext, useContext } from "react";
|
||||
|
||||
const DictionaryContext = createContext<any>(null);
|
||||
|
||||
export function DictionaryProvider({
|
||||
dictionary,
|
||||
children,
|
||||
}: {
|
||||
dictionary: any;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<DictionaryContext.Provider value={dictionary}>
|
||||
{children}
|
||||
</DictionaryContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export function useDictionary() {
|
||||
const context = useContext(DictionaryContext);
|
||||
if (!context) {
|
||||
throw new Error("useDictionary must be used within a DictionaryProvider");
|
||||
}
|
||||
return context;
|
||||
}
|
||||
Reference in New Issue
Block a user