Fixed url formatting in fetch_channels
This commit is contained in:
parent
e57fd498ae
commit
901e0218dd
@ -2,8 +2,10 @@ use cursive::Cursive;
|
||||
use reqwest;
|
||||
use crate::types::Channel;
|
||||
|
||||
pub async fn fetch_channels(domain: &str) -> Option<Vec<Channel>>{
|
||||
if let Ok(resp) = reqwest::get(&format!("{}/channels/list", domain)).await {
|
||||
pub async fn fetch_channels(domain: &str, port: u16) -> Option<Vec<Channel>>{
|
||||
let url = format!("http://{}:{}/channels/list", domain, port);
|
||||
|
||||
if let Ok(resp) = reqwest::get(&url).await {
|
||||
let bytes = resp.bytes().await.unwrap();
|
||||
let res: Result<Vec<Channel>, serde_json::Error> = serde_json::from_slice(&bytes);
|
||||
return match res {
|
||||
|
Loading…
Reference in New Issue
Block a user