Next/Header
Unanswered
Chestnut-backed Chickadee posted this in #help-forum
Chestnut-backed ChickadeeOP
I have API call with bearer token from client and server (client load more pagination). Client call from API route and server call from actions.
if (!isServer) {
res = await httpClient(
{ next: { revalidate: 3600 } }
);
} else {
res = await httpServer(
{ next: { revalidate: 3600 } }
);
}
Added if conition still showing error
You're importing a component that needs next/headers. That only works in a Server Component but one of its parents is marked with "use client", so it's a Client Component.
if (!isServer) {
res = await httpClient(
${apiURLs.articeList}?${category}=${query}&page_no=${pageParam}&page_size=${pageSize},{ next: { revalidate: 3600 } }
);
} else {
res = await httpServer(
${apiURLs.articeList}?${category}=${query}&page_no=${pageParam}&page_size=${pageSize},{ next: { revalidate: 3600 } }
);
}
Added if conition still showing error
You're importing a component that needs next/headers. That only works in a Server Component but one of its parents is marked with "use client", so it's a Client Component.