za actions dodan "noStore"

This commit is contained in:
2024-02-06 14:17:12 +01:00
parent cf97b3d4b5
commit f0581eb533
2 changed files with 14 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import { ObjectId } from 'mongodb';
import { Bill, BillingLocation, YearMonth } from '../db-types';
import { AuthenticatedUser } from '../types/next-auth';
import { withUser } from '../auth';
import { unstable_noStore as noStore } from 'next/cache';
/**
* Server-side action which adds a new month to the database
@@ -15,6 +16,8 @@ import { withUser } from '../auth';
* @returns
*/
export const addMonth = withUser(async (user:AuthenticatedUser, { year, month }: YearMonth) => {
noStore();
const { id: userId } = user;
// update the bill in the mongodb
@@ -60,6 +63,8 @@ export const addMonth = withUser(async (user:AuthenticatedUser, { year, month }:
});
export const fetchAvailableYears = withUser(async (user:AuthenticatedUser) => {
noStore();
const { id: userId } = user;
const dbClient = await getDbClient();