My page gets the result of the database from GetQuizzes() but it is not using fetch, it is directly getting the data from my mongoose model collection.
So when I first load the page it gets all the quizzes in my page, but when I refresh and if there are new quizzes, it doesn't get them, so it has cached the data already right?
How to make my pseudo fetch dynamic?
"use server";
import Home from "./Home";
import { getQuizzes } from "./actions/QuizzActions";
export default async function HomePage() {
const quizzes = await getQuizzes();
return <Home quizzes={quizzes}/>;
}
export async function getQuizzes() {
try {
await connect();
const res = await Quizz.find();
return JSON.parse(JSON.stringify(res));
} catch (err) {
console.log("error fetching the quizzes : ", err);
return [];
}
}