joschan21 / quill

Quill - A Modern SaaS-Platform Built With Next.js 13
1.9k stars 508 forks source link

Dashboard doesn't get loaded at all after logging in #98

Open mshabb opened 6 months ago

mshabb commented 6 months ago

After loggin in, the home page is getting displayed instead of the dashboard. Also, none of the links to the dashboard is working.

Here is my Dashboard file.

'use client'

import { trpc } from '@/app/_trpc/client' import UploadButton from './UploadButton' import { Ghost, Loader2, MessageSquare, Plus, Trash, } from 'lucide-react' import Skeleton from 'react-loading-skeleton' import Link from 'next/link' import { format } from 'date-fns' import { Button } from './ui/button' import { useState } from 'react' import { getUserSubscriptionPlan } from '@/lib/stripe'

interface PageProps { subscriptionPlan: Awaited<ReturnType> }

const Dashboard = ({subscriptionPlan}: PageProps) => {

const [currentlyDeletingFile, setCurrentlyDeletingFile] = useState<string | null>(null)

const utils = trpc.useUtils()

const { data: files, isLoading } = trpc.getUserFiles.useQuery()

const { mutate: deleteFile } = trpc.deleteFile.useMutation({ onSuccess: () => { utils.getUserFiles.invalidate() }, onMutate({ id }) { setCurrentlyDeletingFile(id) }, onSettled() { setCurrentlyDeletingFile(null) }, } )

return (

My Files

{/* display all user files */} {files && files?.length !== 0 ? (
    {files .sort( (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() ) .map((file) => (
  • {file.name}

    {format( new Date(file.createdAt), 'MMM yyyy' )}
    mocked
  • ))}
) : isLoading ? ( ) : (

Pretty empty around here

Let's upload your first PDF.

)}

) }

export default Dashboard

julien-gadonneix commented 1 month ago

same problem

julien-gadonneix commented 1 month ago

I found out that it is due to the middleware.ts file Here is the right middleware.ts file to have with Next.js 14

import {withAuth} from "@kinde-oss/kinde-auth-nextjs/middleware";

export const config = {
    matcher: ["/dashboard/:path*", "/auth-callback"]
}

export default withAuth