upd: add revalidate
This commit is contained in:
@@ -14,8 +14,7 @@ export default function AdminPanelLoading() {
|
||||
<Skeleton className="h-32 w-full rounded-lg" />
|
||||
<Skeleton className="h-32 w-full rounded-lg" />
|
||||
</div>
|
||||
<Skeleton className="h-[500px] w-full rounded-lg" />
|
||||
<Skeleton className="h-[500px] w-full rounded-lg" />
|
||||
<Skeleton className="h-[400px] w-full rounded-lg" />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
import { prisma } from "@/lib/db";
|
||||
import { checkUserStatus } from "@/lib/dto/user";
|
||||
import { getCurrentUser } from "@/lib/session";
|
||||
|
||||
export const revalidate = 60;
|
||||
|
||||
export async function GET(req: Request) {
|
||||
try {
|
||||
const user = checkUserStatus(await getCurrentUser());
|
||||
if (user instanceof Response) return user;
|
||||
if (user.role !== "ADMIN") {
|
||||
return Response.json("Unauthorized", {
|
||||
status: 401,
|
||||
statusText: "Unauthorized",
|
||||
});
|
||||
}
|
||||
|
||||
const threeMonthsAgo = new Date();
|
||||
threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3);
|
||||
|
||||
|
||||
@@ -107,7 +107,9 @@ export function NavBar({ scroll = false }: NavBarProps) {
|
||||
href="/dashboard"
|
||||
className="hidden text-sm font-medium text-foreground/60 transition-colors hover:text-foreground/80 md:block"
|
||||
>
|
||||
Dashboard
|
||||
<Button className="" variant="outline" size="sm" rounded="lg">
|
||||
Dashboard
|
||||
</Button>
|
||||
</Link>
|
||||
<div className="hidden md:flex">
|
||||
<ModeToggle />
|
||||
|
||||
Reference in New Issue
Block a user