From 83820a470ef8128b22804cd03bf78e067b68fe6e Mon Sep 17 00:00:00 2001 From: Dominic Grimm Date: Mon, 19 Dec 2022 21:00:56 +0100 Subject: [PATCH] Update --- src/lib.rs | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 927ece6..c54d77f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -344,22 +344,19 @@ impl Client { } pub async fn login_api(&mut self) -> Result { - dbg!(self.session.as_ref().context("Not logged in")?); - // let jwt = reqwest::Client::new() - // .get(self.api_url.join("token/new")?) - // .header( - // reqwest::header::COOKIE, - // self.session.as_ref().context("Not logged in")?, - // ) - // .send() - // .await? - // .text() - // .await?; - // self.authorization = Some(jwt.to_string()); + let jwt = reqwest::Client::new() + .get(self.api_url.join("token/new")?) + .header( + reqwest::header::COOKIE, + self.session.as_ref().context("Not logged in")?, + ) + .send() + .await? + .text() + .await?; + self.authorization = Some(jwt.to_string()); - // Ok(jwt) - - bail!("ddd"); + Ok(jwt) } pub async fn login(&mut self) -> Result<()> {