fix(tui): abort launch on auth failure, add auth error variant
This commit is contained in:
1 parent
14fd9d1ebc
commit
60385e7916
3 files changed
+12
-13
No files matched your search
@@ -14,6 +14,8 @@ pub enum LaunchError {
|
||||
Json(#[from] serde_json::Error),
|
||||
#[error("{0} launch is not yet supported")]
|
||||
NotSupported(String),
|
||||
#[error("{0}")]
|
||||
Auth(String),
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
@@ -243,7 +245,9 @@ pub async fn launch(
|
||||
Ok(t) => t,
|
||||
Err(e) => {
|
||||
tracing::error!("Token refresh failed: {e}");
|
||||
"0".to_string()
|
||||
return Err(LaunchError::Auth(format!(
|
||||
"Authentication failed: {e}"
|
||||
)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,13 @@ pub fn render(
|
||||
ContentTab::Shaders => shaders_state.search.title_line(),
|
||||
ContentTab::Worlds => worlds_state.search.title_line(),
|
||||
ContentTab::Screenshots => screenshots_state.search.title_line(),
|
||||
ContentTab::Logs => logs_state.search.title_line(),
|
||||
ContentTab::Logs => {
|
||||
if logs_state.viewer_focused {
|
||||
logs_state.viewer_search.title_line()
|
||||
} else {
|
||||
logs_state.search.title_line()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let mut block = Block::default()
|
||||
|
||||
@@ -510,17 +510,6 @@ fn render_viewer(
|
||||
|
||||
frame.render_widget(Paragraph::new(styled_lines), area);
|
||||
|
||||
if let Some(sl) = state.viewer_search.title_line() {
|
||||
let sw = sl.width() as u16;
|
||||
let search_area = Rect {
|
||||
x: area.x + area.width.saturating_sub(sw + 1),
|
||||
y: area.y,
|
||||
width: sw + 1,
|
||||
height: 1,
|
||||
};
|
||||
frame.render_widget(Paragraph::new(sl), search_area);
|
||||
}
|
||||
|
||||
let scrollbar_area = Rect {
|
||||
x: area.x + area.width.saturating_sub(0),
|
||||
y: area.y + 1,
|
||||
|
||||
Reference in new issue
Block a user