Update dependencies, add translation endpoint, and display a user message when logged in
This commit is contained in:
parent
6b043620b8
commit
348b0f24e9
19 changed files with 170 additions and 34 deletions
|
|
@ -1,13 +1,18 @@
|
|||
use axum::{
|
||||
debug_handler,
|
||||
extract::{Extension, State},
|
||||
extract::{Extension, Query, State},
|
||||
http::{HeaderMap, StatusCode},
|
||||
response::{IntoResponse, Result},
|
||||
};
|
||||
use axum_extra::extract::cookie::{Cookie, CookieJar, SameSite};
|
||||
use common::ron_api;
|
||||
|
||||
use crate::{
|
||||
app::Context, consts, data::db, data::model, ron_extractor::ExtractRon, ron_utils::ron_error,
|
||||
app::Context,
|
||||
consts,
|
||||
data::{db, model},
|
||||
ron_extractor::ExtractRon,
|
||||
ron_utils::{ron_error, ron_response_ok},
|
||||
};
|
||||
|
||||
pub mod calendar;
|
||||
|
|
@ -36,6 +41,16 @@ pub async fn set_lang(
|
|||
Ok((jar, StatusCode::OK))
|
||||
}
|
||||
|
||||
#[debug_handler]
|
||||
pub async fn get_translation(
|
||||
Extension(context): Extension<Context>,
|
||||
translation_id: Query<ron_api::Id>,
|
||||
) -> Result<impl IntoResponse> {
|
||||
Ok(ron_response_ok(ron_api::Value {
|
||||
value: context.tr.t_from_id(translation_id.id),
|
||||
}))
|
||||
}
|
||||
|
||||
/*** 404 ***/
|
||||
|
||||
#[debug_handler]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue