GET api/checkAdminStatus 404 (Not Found)
Answered
Lithuanian Hound posted this in #help-forum
Lithuanian HoundOP
Hello, I am getting 404 when fetching 'api/checkAdminStatus' in
What am I doing wrong? I'm using app routing.
useEffect(() => {
async function checkAdminStatus() {
try {
const response = await fetch('api/checkAdminStatus');
const data = await response.json();
setIsAdmin(data.isAdmin);
} catch (error) {
console.error('Error fetching admin status:', error);
}
}
checkAdminStatus();
}, []);What am I doing wrong? I'm using app routing.
2 Replies
Lithuanian HoundOP
I remembered to keep it like this for dashboard/page.tsx, but forgot about api, thank you.