Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions apps/mail/app/(routes)/create/layout.tsx

This file was deleted.

11 changes: 0 additions & 11 deletions apps/mail/app/(routes)/create/page.tsx

This file was deleted.

10 changes: 10 additions & 0 deletions apps/mail/app/(routes)/mail/[folder]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { MailLayout } from '@/components/mail/mail';
import { redirect } from 'next/navigation';
import { auth } from '@/lib/auth';
import { headers } from 'next/headers';

interface MailPageProps {
params: Promise<{
Expand All @@ -9,6 +12,13 @@ interface MailPageProps {
const ALLOWED_FOLDERS = ['inbox', 'draft', 'sent', 'spam', 'trash', 'archive'];

export default async function MailPage({ params }: MailPageProps) {
const headersList = await headers();
const session = await auth.api.getSession({ headers: headersList });

if (!session) {
redirect('/');
}

const { folder } = await params;

if (!ALLOWED_FOLDERS.includes(folder)) {
Expand Down
12 changes: 11 additions & 1 deletion apps/mail/app/(routes)/mail/create/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import { CreateEmail } from '@/components/create/create-email';
import { auth } from '@/lib/auth';
import { headers } from 'next/headers';
import { redirect } from 'next/navigation';

export default async function CreatePage() {
const headersList = await headers();
const session = await auth.api.getSession({ headers: headersList });

if (!session) {
redirect('/');
}

export default function CreatePage() {
return (
<div className="flex h-full w-full flex-col">
<div className="h-full flex-1">
Expand Down