Refetch on route re enter
Unanswered
DieZitrone posted this in #help-forum
Lets say I have a sr page /posts and I change to to /home and go back to /posts again, how to I make it fetch again?
2 Replies
My current fetch
const getLikedPosts = async (): Promise<IPostIdea[] | null> => {
const response = await fetch(
`${process.env.NEXT_PUBLIC_BACKEND}/socials/liked-posts`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${cookieStore.get("access_token")!.value}`,
},
}
);
if (!response.ok) {
return null;
}
const data = await response.json();
const liked_posts = data["liked_posts"];
console.log(liked_posts);
return liked_posts;
};I tried no-store already