Next.js Discord

Discord Forum

Get api from client side to server

Unanswered
Somali posted this in #help-forum
Open in Discord
SomaliOP
I have a user collection where some of users have role: employer, when I want to check if an user is employer or not I am facing the problem.

So the problem is, I am checking this with user'e email, and email comes from AuthContext, as authcontext is a client component, so I can call get api.

#help

5 Replies

So what was the problem?
SomaliOP
The problem is AuthContext is in client component, you must use "use client " to use auth contenxt, but i can't send request to server from client component
you can send request to server from client component though
if not why not?
Think reverse way
Instead of server ->clint
Use Clint -> server