fix crash when cannot connect to the api

This commit is contained in:
Mylloon 2021-12-21 10:04:51 +01:00
parent 6f856a4e96
commit b499a106d6
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -5,7 +5,14 @@ pub async fn connexion(token: &str, url: &str) {
let auth = AuthenticationData::from_access_token(&token); let auth = AuthenticationData::from_access_token(&token);
let mut api = Mattermost::new(url, auth); let mut api = Mattermost::new(url, auth);
api.store_session_token().await.unwrap(); api.store_session_token().await.unwrap();
let team_info = api.get_team_info("etudiant-es").await.unwrap(); let team_info = api.get_team_info("etudiant-es").await;
println!("{:?}", team_info); match team_info {
Ok(infos) => {
println!("Information sur la team : {:?}", infos);
}
Err(e) => {
println!("Error: {}", e);
}
}
} }