fix(characters): reset route actors on character change
This commit is contained in:
@@ -1,11 +1,23 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
import { getCharacterBySlug } from "@/data/constants/character";
|
||||
import { PaymentRouteProvider } from "@/providers/payment-route-provider";
|
||||
|
||||
export default function CharacterTipLayout({
|
||||
export default async function CharacterTipLayout({
|
||||
children,
|
||||
params,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
params: Promise<{ characterSlug: string }>;
|
||||
}) {
|
||||
return <PaymentRouteProvider>{children}</PaymentRouteProvider>;
|
||||
const { characterSlug } = await params;
|
||||
const character = getCharacterBySlug(characterSlug);
|
||||
if (!character) notFound();
|
||||
|
||||
return (
|
||||
<PaymentRouteProvider scopeKey={character.id}>
|
||||
{children}
|
||||
</PaymentRouteProvider>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user