procrastinator_bas
WWasp-lang
•Created by procrastinator_bas on 8/25/2024 in #đŸ™‹questions
Getting the user in the rootcomponent
I specified the rootComponent for my client:
In my Root.tsx I want to check if the user is logged in, so I can check which menu items to show:
This does not work. Even if the user is logged in, the Header only shows this button:
<NavLink to='/login'><Button size="s">Login</Button></NavLink>
Is it possible to access the user in the rootComponent?26 replies
WWasp-lang
•Created by procrastinator_bas on 8/25/2024 in #đŸ™‹questions
Accessing/changing another entity when performing a db action
I'm new to NodeJS, prisma and the likes and am having some trouble implementing an action.
When I create a Student, they need to get a number assigned to them.
If there are already 10 students in the class, the next created student should get number 11.
I'm not sure how to best do this.
This us my current code:
I tried calling the getClass query from the createStudent action and passing the cotext along, but it is not of the correct type.
Should I send along the classId from the frontend, even though the frontend does not need to know about it?
Should I just use the prismaClient and the full context over the wasp context?
37 replies