25 lines
462 B
Rust
25 lines
462 B
Rust
use actix_session::Session;
|
|
use actix_web::{
|
|
HttpResponse, get, post,
|
|
web::{self, ServiceConfig},
|
|
};
|
|
use serde::Deserialize;
|
|
|
|
use crate::error::ApiError;
|
|
|
|
#[derive(Deserialize)]
|
|
struct LoginRequest {
|
|
username: String,
|
|
password: String,
|
|
}
|
|
|
|
pub fn setup(cfg: &mut ServiceConfig) {
|
|
cfg.service(login);
|
|
}
|
|
|
|
#[post("/login")]
|
|
async fn login(
|
|
login_request: web::Json<LoginRequest>,
|
|
session: Session,
|
|
) -> Result<HttpResponse, ApiError> {
|
|
}
|