adrianhajdin / threads

Develop Threads, Next.js 13 app that skyrocketed to 100 million sign-ups in less than 5 days, and dethroned giants like Twitter, ChatGPT, and TikTok to become the fastest-growing app ever!
https://threads-psi.vercel.app
1.42k stars 272 forks source link

Post Thread Button not working #83

Open Nandita-Kumari opened 9 months ago

Nandita-Kumari commented 9 months ago

Whenever i click on Post thread button, it throws error of invalid url in the UI.

dannweeeee commented 9 months ago

Hi you might want to check your code in /app/(root)/create-thread/page.tsx. It should be:

import PostThread from '@/components/forms/PostThread';
import { fetchUser } from '@/lib/actions/user.actions';
import { currentUser } from '@clerk/nextjs';
import { redirect } from 'next/navigation';

async function Page() {
    const user = await currentUser();

    if(!user) return null;

    // fetch organization list created by user
    const userInfo = await fetchUser(user.id);
    if (!userInfo?.onboarded) redirect("/onboarding"); // move all the users that maybe switch their url bar manually, it will bring them back to onboarding

    return (
        <>
          <h1 className='head-text'>Create Thread</h1>

          <PostThread userId={userInfo._id} />
        </>
    );
}

export default Page;
ktk04 commented 4 months ago

Hello, did u get it to work btw? Facing the same problem