remove the extract macro

This commit is contained in:
Evan Almloff committed 2023-07-12 16:20:44 -06:00
1 parent 0636e94f37
commit c6ddee6f21
4 files changed
+9 -68

No files matched your search

@@ -121,23 +121,22 @@ fn app(cx: Scope) -> Element {
}
#[server(GetUserName)]
pub async fn get_user_name(
#[extract] session: crate::auth::Session,
) -> Result<String, ServerFnError> {
pub async fn get_user_name() -> Result<String, ServerFnError> {
let session: crate::auth::Session = extract().await?;
Ok(session.0.current_user.unwrap().username.to_string())
}
#[server(Login)]
pub async fn login(#[extract] auth: crate::auth::Session) -> Result<(), ServerFnError> {
pub async fn login() -> Result<(), ServerFnError> {
let auth: crate::auth::Session = extract().await?;
auth.login_user(2);
Ok(())
}
#[server(Permissions)]
pub async fn get_permissions(
#[extract] method: axum::http::Method,
#[extract] auth: crate::auth::Session,
) -> Result<String, ServerFnError> {
pub async fn get_permissions() -> Result<String, ServerFnError> {
let method: axum::http::Method = extract().await?;
let auth: crate::auth::Session = extract().await?;
let current_user = auth.current_user.clone().unwrap_or_default();
// lets check permissions only and not worry about if they are anon or not