From bd373bffae8bc4c74c5e5262481747ba722763c9 Mon Sep 17 00:00:00 2001 From: Neshura Date: Sat, 13 Jan 2024 16:20:03 +0100 Subject: [PATCH] Fix logout type mismatch + remove some unused imports --- src/jnovel.rs | 2 +- src/main.rs | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/jnovel.rs b/src/jnovel.rs index 893c52d..2fd9531 100644 --- a/src/jnovel.rs +++ b/src/jnovel.rs @@ -49,7 +49,7 @@ impl State { } } - pub(crate) async fn logout(state: &Self) { + pub(crate) async fn logout(state: State) { let client = reqwest::Client::new(); let url = api!() + format!("app/v1/auth/logout?{:?}", state.token).as_str(); diff --git a/src/main.rs b/src/main.rs index 9ec230b..5570b67 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,10 @@ mod download; mod jnovel; -use iced::{Alignment, Application, Command, Element, executor, Length, Padding, Pixels, Settings, Subscription, subscription, Theme, time}; +use iced::{Application, Command, Element, executor, Length, Padding, Pixels, Settings, Subscription, subscription, Theme, time}; use iced::widget::{button, column, text, Column, container, toggler::{Toggler}, pick_list, row, Row, text_input}; use std::fmt::{Display, Formatter}; -use arrayvec::ArrayString; -use chrono::{DateTime, Local, Utc}; -use reqwest::StatusCode; +use chrono::{Local}; use serde::{Deserialize}; #[derive(Debug, Clone)] @@ -121,7 +119,7 @@ impl Application for CalibreWebImporter { println!("Logging out from J-Novel Club"); self.jnc.token = None; self.jnc.login_state = jnovel::LoginState::LoggedOut; - Command::perform(jnovel::State::logout(self.jnc.clone()), || Message::JncAction(jnovel::Message::LoginState(jnovel::LoginState::LoggedOut))) + Command::perform(jnovel::State::logout(self.jnc.clone()), |()| Message::JncAction(jnovel::Message::LoginState(jnovel::LoginState::LoggedOut))) } jnovel::Message::LoginState(status) => { if let jnovel::LoginState::Success(token) = status {