Redirect from /admin/uploads when there are no uploads
This commit is contained in:
parent
e1f1425373
commit
90d26a1fd1
@ -2,19 +2,26 @@ import { getStorageUploadUrlsNoStore } from '@/platforms/storage/cache';
|
||||
import SiteGrid from '@/components/SiteGrid';
|
||||
import { getUniqueTagsCached } from '@/photo/cache';
|
||||
import AdminUploadsClient from '@/admin/AdminUploadsClient';
|
||||
import { redirect } from 'next/navigation';
|
||||
import { PATH_ADMIN_PHOTOS } from '@/app/paths';
|
||||
|
||||
export const maxDuration = 60;
|
||||
|
||||
export default async function AdminUploadsPage() {
|
||||
const urls = await getStorageUploadUrlsNoStore();
|
||||
const uniqueTags = await getUniqueTagsCached();
|
||||
return (
|
||||
<SiteGrid
|
||||
contentMain={
|
||||
<AdminUploadsClient {...{
|
||||
urls,
|
||||
uniqueTags,
|
||||
}} />}
|
||||
/>
|
||||
);
|
||||
|
||||
if (urls.length === 0) {
|
||||
redirect(PATH_ADMIN_PHOTOS);
|
||||
} else {
|
||||
return (
|
||||
<SiteGrid
|
||||
contentMain={
|
||||
<AdminUploadsClient {...{
|
||||
urls,
|
||||
uniqueTags,
|
||||
}} />}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user