fix hook order error
This commit is contained in:
@ -14,10 +14,11 @@ const ConversationPage: BlitzPage = () => {
|
||||
|
||||
const router = useRouter();
|
||||
const recipient = decodeURIComponent(router.params.recipient);
|
||||
const pageTitle = `Messages with ${recipient}`;
|
||||
const conversation = useConversation(recipient)[0];
|
||||
|
||||
return (
|
||||
<>
|
||||
<Layout title={pageTitle} hideFooter>
|
||||
<header className="absolute top-0 w-screen h-12 backdrop-filter backdrop-blur-sm bg-white bg-opacity-75 border-b grid grid-cols-3 items-center">
|
||||
<span className="col-start-1 col-span-1 pl-2 cursor-pointer" onClick={router.back}>
|
||||
<FontAwesomeIcon size="lg" className="h-8 w-8" icon={faLongArrowLeft} />
|
||||
@ -31,18 +32,6 @@ const ConversationPage: BlitzPage = () => {
|
||||
<Suspense fallback={<div className="pt-12">Loading messages with {recipient}</div>}>
|
||||
<Conversation />
|
||||
</Suspense>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
ConversationPage.getLayout = function ConversationLayout(page) {
|
||||
const router = useRouter();
|
||||
const recipient = decodeURIComponent(router.params.recipient);
|
||||
const pageTitle = `Messages with ${recipient}`;
|
||||
|
||||
return (
|
||||
<Layout title={pageTitle} hideFooter>
|
||||
{page}
|
||||
</Layout>
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user