Extension of user
in AuthSession
#139
-
Hi :) Sorry if this is a stupid question and it is already possible. But previously, I was able to do something like this: pub fn home(Extension(user): Extension<user>) -> impl IntoResponse {
todo!();
} And I would have access to the user immediately. After the updates lately, I can only see docs and examples for getting it from pub fn home(auth: AuthSession) -> impl IntoResponse {
let user = auth.user;
todo!();
} I really liked to be able to get the user with an extension like I could previously. Is this possible in some way? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
We removed the If you feel like it simplifies your code, you could write something like this instead: pub fn home(AuthSession { user, ... }: AuthSession) -> impl IntoResponse {
todo!();
} I don't think we're opposed to adding the extension again, but it's not clear it's really needed. |
Beta Was this translation helpful? Give feedback.
-
If I'm not wrong, the Thanks for all your work on this crate! |
Beta Was this translation helpful? Give feedback.
We removed the
User
extension because it seemed redundant with the session.If you feel like it simplifies your code, you could write something like this instead:
I don't think we're opposed to adding the extension again, but it's not clear it's really needed.