Fix logout type mismatch + remove some unused imports
Some checks failed
Run Tests on Code / run-tests (push) Failing after 1m2s
Build binary file and bundle packages / test (pull_request) Failing after 1m2s
Build binary file and bundle packages / build (pull_request) Has been skipped

This commit is contained in:
Neshura 2024-01-13 16:20:03 +01:00
parent 53e6f72cbb
commit bd373bffae
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C
2 changed files with 4 additions and 6 deletions

View file

@ -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 client = reqwest::Client::new();
let url = api!() + format!("app/v1/auth/logout?{:?}", state.token).as_str(); let url = api!() + format!("app/v1/auth/logout?{:?}", state.token).as_str();

View file

@ -1,12 +1,10 @@
mod download; mod download;
mod jnovel; 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 iced::widget::{button, column, text, Column, container, toggler::{Toggler}, pick_list, row, Row, text_input};
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
use arrayvec::ArrayString; use chrono::{Local};
use chrono::{DateTime, Local, Utc};
use reqwest::StatusCode;
use serde::{Deserialize}; use serde::{Deserialize};
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -121,7 +119,7 @@ impl Application for CalibreWebImporter {
println!("Logging out from J-Novel Club"); println!("Logging out from J-Novel Club");
self.jnc.token = None; self.jnc.token = None;
self.jnc.login_state = jnovel::LoginState::LoggedOut; 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) => { jnovel::Message::LoginState(status) => {
if let jnovel::LoginState::Success(token) = status { if let jnovel::LoginState::Success(token) = status {