-
Notifications
You must be signed in to change notification settings - Fork 704
/
Copy pathpage.tsx
28 lines (24 loc) · 841 Bytes
/
page.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"use client";
import { useEffect } from "react";
import { useRouter, useSearchParams } from "next/navigation";
import { LoadingContent } from "@/components/LoadingContent";
export default function MailRedirect() {
const router = useRouter();
const searchParams = useSearchParams();
const type = searchParams.get("type") || "inbox";
const threadId = searchParams.get("thread-id");
useEffect(() => {
if (threadId) {
// Redirect to the new URL structure for thread view
router.replace(`/mail/${type}/${threadId}`);
} else {
// Redirect to the new URL structure for mail list
router.replace(`/mail/${type}`);
}
}, [router, type, threadId]);
return (
<div className="flex h-full items-center justify-center">
<LoadingContent loading={true}>{null}</LoadingContent>
</div>
);
}