blow up without patrone

Signed-off-by: Xe Iaso <me@christine.website>
This commit is contained in:
Cadey Ratio 2022-04-05 20:59:35 -04:00
parent 3a4827c887
commit ea8e1e045a
1 changed files with 3 additions and 7 deletions

View File

@ -125,18 +125,14 @@ pub struct Links {
impl Client { impl Client {
pub fn new() -> Result<Self> { pub fn new() -> Result<Self> {
let mut creds = Credentials::default();
let p = Path::new(".patreon.json"); let p = Path::new(".patreon.json");
if p.exists() {
let config = fs::read_to_string(p)?; let config = fs::read_to_string(p)?;
creds = serde_json::from_str(&config)?; let creds: Credentials = serde_json::from_str(&config)?;
}
Ok(Self { Ok(Self {
cli: reqwest::Client::new(), cli: reqwest::Client::new(),
base_url: "https://api.patreon.com".into(), base_url: "https://api.patreon.com".into(),
creds: creds, creds,
}) })
} }