Changed auth_user_with_token to only accept an object
This commit is contained in:
parent
44a0c92699
commit
671a448fd7
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -99,7 +99,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "dev-dtos"
|
name = "dev-dtos"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://backend:Eo1n1TPsyWV7wwo9uFwgUJGKKheMM6paM2mDkVPA4zqkh5dt6Q6XPkbtojzYQudQsM84vSwKmhHHTPjyn535d6NLBmA3meeGj0Gb8if4sceAwvySdmzedg5mN2P5zzQt@gitea.blancoinfante.com/blancoinfante_backend/dev-dtos-rust.git#d8e899e4f208be54d1e7f93a2948de55309e88f3"
|
source = "git+https://backend:Eo1n1TPsyWV7wwo9uFwgUJGKKheMM6paM2mDkVPA4zqkh5dt6Q6XPkbtojzYQudQsM84vSwKmhHHTPjyn535d6NLBmA3meeGj0Gb8if4sceAwvySdmzedg5mN2P5zzQt@gitea.blancoinfante.com/blancoinfante_backend/dev-dtos-rust.git#8c59fdee30acd9f7dbaafd28660e47f2d275eb61"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -6,8 +6,9 @@ use crate::middleware::client::perform_request;
|
|||||||
//TODO: Move this into a separate service
|
//TODO: Move this into a separate service
|
||||||
const BASE_URL_USER_SVC: &str = "http://backend.blancoinfante.com";
|
const BASE_URL_USER_SVC: &str = "http://backend.blancoinfante.com";
|
||||||
|
|
||||||
pub async fn authenticate_user_with_token(client: &Client, user: &UserForAuthenticationDto, user_id: &i32) -> Result<User, Error> {
|
pub async fn authenticate_user_with_token(client: &Client, user: &UserForAuthenticationDto) -> Result<User, Error> {
|
||||||
perform_request::<&UserForAuthenticationDto, User>(BASE_URL_USER_SVC.to_string(), client, Method::POST, format!("/user/auth/token/{}", user_id), Some(user), 200, vec![(String::from("auth-token"), user.token.clone())]).await
|
//TODO: Remove the need for a userdto, just get token and Id, dont send the body
|
||||||
|
perform_request::<&UserForAuthenticationDto, User>(BASE_URL_USER_SVC.to_string(), client, Method::POST, format!("/user/auth/token/{}", user.id), None, 200, vec![(String::from("auth-token"), user.token.clone())]).await
|
||||||
}
|
}
|
||||||
pub async fn create_user(client: &Client, user: &UserForCreationDto) -> Result<Token, Error> {
|
pub async fn create_user(client: &Client, user: &UserForCreationDto) -> Result<Token, Error> {
|
||||||
perform_request::<&UserForCreationDto, Token>(BASE_URL_USER_SVC.to_string(), client, Method::POST, "/user".to_string(), Some(user), 200, vec![]).await
|
perform_request::<&UserForCreationDto, Token>(BASE_URL_USER_SVC.to_string(), client, Method::POST, "/user".to_string(), Some(user), 200, vec![]).await
|
||||||
|
Loading…
Reference in New Issue
Block a user