fix hook order error

This commit is contained in:
m5r
2021-08-30 08:34:37 +08:00
parent 74f903cc9f
commit 3d1c545892
4 changed files with 7 additions and 18 deletions

View File

@ -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>
);
};