gatherer: add host to store when having token

This commit is contained in:
Astro 2023-08-09 00:07:20 +02:00
parent cda567d0bc
commit dd3dabf356
2 changed files with 5 additions and 4 deletions

View File

@ -48,16 +48,18 @@ pub struct OAuthCode {
}
pub async fn get_token_collect(
Extension(ServerState { db, http_client, .. }): Extension<ServerState>,
Extension(ServerState { db, http_client, mut store, .. }): Extension<ServerState>,
extract::Path(host): extract::Path<String>,
extract::Query(OAuthCode { code }): extract::Query<OAuthCode>,
) -> impl IntoResponse {
match collect_token(db, &http_client, &host, code.clone()).await {
Ok(()) =>
Ok(()) => {
let _ = store.save_host(&host).await;
(
StatusCode::SEE_OTHER,
[("location", "/token/thanks")]
).into_response(),
).into_response()
}
Err(e) => {
tracing::error!("{}", e);
return (

View File

@ -14,7 +14,6 @@ pub async fn get_token_donate() -> impl IntoResponse {
}
#[derive(serde::Deserialize, Debug)]
//#[allow(dead_code)]
pub struct TokenDonateForm {
instance: String,
}