Started to implement accounts in the UI.
This commit is contained in:
1 parent
ce92916942
commit
76e1e8cb53
7 files changed
+172
-9
No files matched your search
+11
-2
@@ -5,6 +5,7 @@ use actix_web_lab::respond::Html;
|
||||
|
||||
use log::info;
|
||||
use minijinja::context;
|
||||
use rusqlite::params;
|
||||
use serde::Deserialize;
|
||||
use uuid::Uuid;
|
||||
|
||||
@@ -19,8 +20,16 @@ pub async fn actions(tmpl_env: MiniJinjaRenderer) -> actix_web::Result<impl Resp
|
||||
}
|
||||
|
||||
#[actix_web::get("/accounts")]
|
||||
pub async fn accounts(tmpl_env: MiniJinjaRenderer) -> actix_web::Result<impl Responder> {
|
||||
tmpl_env.render("accounts.html", ())
|
||||
pub async fn accounts(tmpl_env: MiniJinjaRenderer,
|
||||
req: HttpRequest,
|
||||
service_factory: web::Data<ServicesFactory>) -> actix_web::Result<impl Responder> {
|
||||
let conn = service_factory.get_connection()?;
|
||||
let auth_service = service_factory.get_authentication_service()?;
|
||||
let user = auth_service.get_login(&req);
|
||||
let account_service = service_factory.get_account_service(& conn)?;
|
||||
let accounts = account_service.get_user_accounts(user.unwrap())
|
||||
.map_err(actix_web::error::ErrorInternalServerError)?;
|
||||
tmpl_env.render("accounts.html", context!{accounts => accounts})
|
||||
}
|
||||
|
||||
#[actix_web::get("/overview")]
|
||||
|
||||
Reference in new issue
Block a user