Next.js Discord

Discord Forum

GET api/checkAdminStatus 404 (Not Found)

Answered
Lithuanian Hound posted this in #help-forum
Open in Discord
Lithuanian HoundOP
Hello, I am getting 404 when fetching 'api/checkAdminStatus' in

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.
Answered by joulev
it has to be checkAdminStatus/route.ts
View full answer

2 Replies