new params when calling trpc

im building new project and using the newest create.t3.app and came across this new params, can anyone tell me what is this? thankss
9 Replies
julius
julius•2y ago
it makes it so that the getSecretMessage query is only enabled if there is an authenticated user
arete
areteOP•2y ago
so with that in place i can check the user role, right?
arete
areteOP•2y ago
and dont need this middleware?
julius
julius•2y ago
You still want to check serverside using middleware Else someone could just type the url in their browser and it wouldnt be protected
arete
areteOP•2y ago
so if dont write the 'enabled' params, is it ok?
julius
julius•2y ago
yea
arete
areteOP•2y ago
ahhh oke thanks juliusđź‘Ť
julius
julius•2y ago
it would just hit your middleware and error on the way so the enabled prop is there to "delay" the query until we actually have an authed user so we don't get a bunch of errors in the console i think that was the main driver for it - since a lot complained about their consoles getting errors on a fresh app since they weren't logged in
arete
areteOP•2y ago
ok i think i understand 🫡
Want results from more Discord servers?
Add your server