za actions dodan "noStore"
This commit is contained in:
@@ -7,7 +7,7 @@ import { ObjectId } from 'mongodb';
|
||||
import { withUser } from '@/app/lib/auth';
|
||||
import { AuthenticatedUser } from '../types/next-auth';
|
||||
import { gotoHome } from './navigationActions';
|
||||
import { Noto_Sans_Tamil_Supplement } from 'next/font/google';
|
||||
import { unstable_noStore as noStore } from 'next/cache';
|
||||
import { asyncTimeout } from '../asyncTimeout';
|
||||
|
||||
export type State = {
|
||||
@@ -35,6 +35,8 @@ const UpdateLocation = FormSchema.omit({ _id: true });
|
||||
*/
|
||||
export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locationId: string | undefined, yearMonth: YearMonth | undefined, prevState:State, formData: FormData) => {
|
||||
|
||||
noStore();
|
||||
|
||||
const validatedFields = UpdateLocation.safeParse({
|
||||
locationName: formData.get('locationName'),
|
||||
locationNotes: formData.get('locationNotes'),
|
||||
@@ -95,6 +97,8 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
|
||||
|
||||
export const fetchAllLocations = withUser(async (user:AuthenticatedUser, year:number) => {
|
||||
|
||||
noStore();
|
||||
|
||||
const dbClient = await getDbClient();
|
||||
|
||||
const { id: userId } = user;
|
||||
@@ -119,6 +123,8 @@ export const fetchAllLocations = withUser(async (user:AuthenticatedUser, year:nu
|
||||
|
||||
export const fetchLocationById = withUser(async (user:AuthenticatedUser, locationID:string) => {
|
||||
|
||||
noStore();
|
||||
|
||||
const dbClient = await getDbClient();
|
||||
|
||||
const { id: userId } = user;
|
||||
@@ -138,6 +144,8 @@ export const fetchLocationById = withUser(async (user:AuthenticatedUser, locatio
|
||||
|
||||
export const deleteLocationById = withUser(async (user:AuthenticatedUser, locationID:string, yearMonth:YearMonth) => {
|
||||
|
||||
noStore();
|
||||
|
||||
const dbClient = await getDbClient();
|
||||
|
||||
const { id: userId } = user;
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user