Files
cozsweet-frontend-nextjs/src/providers/chat-route-providers.tsx
T

32 lines
953 B
TypeScript

"use client";
import type { ReactNode } from "react";
import { DEFAULT_CHARACTER_ID } from "@/data/constants/character";
import { ChatProvider } from "@/stores/chat/chat-context";
import { PaymentProvider } from "@/stores/payment/payment-context";
import { ChatAuthSync } from "@/stores/sync/chat-auth-sync";
import { ChatPaymentSuccessSync } from "@/stores/sync/chat-payment-success-sync";
import { PaymentSuccessSync } from "@/stores/sync/payment-success-sync";
export interface ChatRouteProvidersProps {
children: ReactNode;
characterId?: string;
}
export function ChatRouteProviders({
children,
characterId = DEFAULT_CHARACTER_ID,
}: ChatRouteProvidersProps) {
return (
<PaymentProvider key={characterId}>
<PaymentSuccessSync />
<ChatProvider key={characterId} characterId={characterId}>
<ChatAuthSync />
<ChatPaymentSuccessSync />
{children}
</ChatProvider>
</PaymentProvider>
);
}