Redirect to canonical photo path when un-favoriting
This commit is contained in:
parent
e3cd0e59cd
commit
fb393f4fc4
@ -20,6 +20,7 @@ export default function AdminPhotoMenuClient({
|
||||
const path = usePathname();
|
||||
const shouldRedirectFav = isPathFavs(path) && isFav;
|
||||
const shouldRedirectDelete = pathForPhoto(photo.id) === path;
|
||||
|
||||
return (
|
||||
<>
|
||||
<MoreMenu {...{
|
||||
|
||||
@ -24,7 +24,12 @@ import {
|
||||
revalidatePhotosKey,
|
||||
revalidateTagsKey,
|
||||
} from '@/photo/cache';
|
||||
import { PATH_ADMIN_PHOTOS, PATH_ADMIN_TAGS, PATH_ROOT } from '@/site/paths';
|
||||
import {
|
||||
PATH_ADMIN_PHOTOS,
|
||||
PATH_ADMIN_TAGS,
|
||||
PATH_ROOT,
|
||||
pathForPhoto,
|
||||
} from '@/site/paths';
|
||||
import { extractExifDataFromBlobPath } from './server';
|
||||
import { TAG_FAVS, isTagFavs } from '@/tag';
|
||||
import { convertPhotoToPhotoDbInsert } from '.';
|
||||
@ -66,7 +71,7 @@ export async function toggleFavoritePhotoAction(
|
||||
await sqlUpdatePhoto(convertPhotoToPhotoDbInsert(photo));
|
||||
revalidateAllKeysAndPaths();
|
||||
if (shouldRedirect) {
|
||||
redirect(PATH_ROOT);
|
||||
redirect(pathForPhoto(photoId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user