You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to filter an objects association with the id of my current user which I put in the context via middleware.
I am trying to find, and failing, a way to pass this to the dataloader method I have setup in the context.
defquery(UserExerciseFavourite,args)do# I want the user id in args#...end
I can pass arguments this way:
object:exercisedo# I can pass arguments this wayfield:user_exercise_favourites,list_of(:user_exercise_favourite)doresolve(dataloader(Exercises,:user_exercise_favourites,args: %{foo: "bar"}))endend
And I can access the id this way, but I can't find the way to then pass it to the method like I can above!
field:user_exercise_favourites,list_of(:user_exercise_favourite)doresolvefnexercise,_,%{context: %{loader: loader}=context}->user_id=context|>Map.get(:current_user)Logger.debug("\n\n User: #{inspectuser_id}\n\n")# How can I take my user out of the context and pass to the Dataloader?loader|>on_load(fnloader->{:ok,Dataloader.load(loader,Exercises,:user_exercise_favourites,exercise)}end)endend
Any tips please!
The text was updated successfully, but these errors were encountered:
I'm trying to filter an objects association with the id of my current user which I put in the context via middleware.
I am trying to find, and failing, a way to pass this to the dataloader method I have setup in the context.
I can pass arguments this way:
And I can access the id this way, but I can't find the way to then pass it to the method like I can above!
Any tips please!
The text was updated successfully, but these errors were encountered: