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
20 changes: 20 additions & 0 deletions src/app/album/detail/[albumId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import ScreenAlbumDetail from '@/feature/album/detail/components/ScreenAlbumDetail';
import { ApiReturns, EP } from '@/global/api/ep';
import { serverApi } from '@/global/utils/serverApi';
import { redirect } from 'next/navigation';

interface PageProps {
params: Promise<{
Expand All @@ -8,6 +11,23 @@ interface PageProps {

export default async function Page({ params }: PageProps) {
const { albumId } = await params;
let isExpired = false;

try {
const { result } = await serverApi.get<ApiReturns['album.invitation']>({
path: EP.album.invitation(albumId),
});

if (result?.isExpired) {
isExpired = true;
}
} catch (e) {
console.log(e);
}
Comment thread
dasosann marked this conversation as resolved.

if (isExpired) {
redirect(`/album/4cut/${albumId}`);
}

return <ScreenAlbumDetail albumId={albumId} />;
}
19 changes: 19 additions & 0 deletions src/app/album/entry/[albumId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

export async function generateMetadata(
{ params }: PageProps,
parent: ResolvingMetadata,

Check warning on line 8 in src/app/album/entry/[albumId]/page.tsx

View workflow job for this annotation

GitHub Actions / lint

'parent' is defined but never used
): Promise<Metadata> {
let title = '';
const { albumId } = await params;
Expand Down Expand Up @@ -45,8 +45,27 @@
params: Promise<{ albumId: string }>;
}

import { redirect } from 'next/navigation';

export default async function Page({ params }: PageProps) {
const { albumId } = await params;
let isExpired = false;

try {
const { result } = await serverApi.get<ApiReturns['album.invitation']>({
path: EP.album.invitation(albumId),
});

if (result?.isExpired) {
isExpired = true;
}
} catch (e) {
console.log(e);
}
Comment thread
dasosann marked this conversation as resolved.

if (isExpired) {
redirect(`/album/4cut/${albumId}`);
}

return <ScreenAlbumEntry albumId={albumId} />;
}
2 changes: 1 addition & 1 deletion src/feature/album/detail/components/ScreenAlbumDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default function ScreenAlbumDetail({ albumId }: ScreenAlbumDetailProps) {
access_type: 'member',
});
}
}, [albumInformData?.myRole]);
}, [albumInformData?.myRole, albumId]);

useEffect(() => {
const target = albumInfosRef.current;
Expand Down
Loading