Skip to content

Commit

Permalink
revalidatePath on reading progress update
Browse files Browse the repository at this point in the history
  • Loading branch information
SnowySailor authored and m-wynn committed Oct 7, 2024
1 parent ea6089e commit 9a42df4
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { ReadingSelectQuery, Reading } from 'lib/reading';
import prisma from 'db';
import { getSession } from 'lib/session';
import { revalidatePath } from 'next/cache';

const updateReadingInDb = async (
reading: Reading | null,
Expand Down Expand Up @@ -58,5 +59,7 @@ export const updateReadingProgress = async (volumeId: number, page: number) => {
select: ReadingSelectQuery,
});

return updateReadingInDb(reading, volumeId, page, userId);
const updatedReading = await updateReadingInDb(reading, volumeId, page, userId);
revalidatePath(`/reader/${updatedReading!.volume.seriesId}/${volumeId}/`);
return updatedReading;
};

0 comments on commit 9a42df4

Please sign in to comment.