pass lint

This commit is contained in:
Wyvest 2026-02-25 21:03:12 -05:00
parent e7bb7d6b70
commit aecfbad53a
5 changed files with 27 additions and 30 deletions

View file

@ -20,7 +20,7 @@ export function AddAccountModalButton() {
const [authError, setAuthError] = useState<unknown>(null);
const { data: profile, isPending, mutate: login } = useCommandMut(bindings.core.openMsaLogin, {
onSuccess(data) {
onSuccess() {
setAuthError(null);
queryClient.invalidateQueries({
queryKey: ['getUsers'],

View file

@ -1,4 +1,4 @@
import { minecraftAuthErrors, MinecraftAuthErrorModal, Overlay, RawDebugInfo, SettingsRow, SettingsSwitch, useDebugInfo } from '@/components';
import { MinecraftAuthErrorModal, minecraftAuthErrors, Overlay, RawDebugInfo, SettingsRow, SettingsSwitch, useDebugInfo } from '@/components';
import { useSettings } from '@/hooks/useSettings';
import { bindings } from '@/main';
import { Button } from '@onelauncher/common/components';

View file

@ -58,7 +58,7 @@ function RouteComponent() {
return bindings.core.getDefaultUser(true);
});
const { data: profile, isPending, mutate: login } = useCommandMut(bindings.core.openMsaLogin, {
onSuccess(data) {
onSuccess() {
setAuthError(null);
queryClient.invalidateQueries({
queryKey: ['getDefaultUser'],

View file

@ -666,32 +666,28 @@ impl TauriLauncherApi for TauriLauncherApiImpl {
return Ok(None);
}
let current_url = match win.url() {
Ok(u) => u,
Err(_) => {
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
continue;
}
let Ok(current_url) = win.url() else {
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
continue;
};
if current_url
.as_str()
.starts_with("https://login.live.com/oauth20_desktop.srf")
&& let Some((_, code)) = current_url.query_pairs().find(|x| x.0 == "code")
{
if let Some((_, code)) = win.url()?.query_pairs().find(|x| x.0 == "code") {
win.close()?;
let value = api::credentials::finish(&code.clone(), flow)
.await
.map_err(|e| {
tracing::error!(
"[auth] open_msa_login() - credentials::finish() failed: {:?}",
e
);
win.close()?;
let value = api::credentials::finish(code.as_ref(), flow)
.await
.map_err(|e| {
tracing::error!(
"[auth] open_msa_login() - credentials::finish() failed: {:?}",
e
})?;
);
e
})?;
return Ok(Some(value));
}
return Ok(Some(value));
}
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
}

View file

@ -38,15 +38,16 @@ impl CredentialsStore {
let path = Dirs::get_auth_file().await?;
let store = io::read_json::<Self>(&path).await.ok();
if let Some(s) = store {
Ok(s)
} else {
Ok(Self {
users: HashMap::new(),
token: None,
default_user: None,
})
}
store.map_or_else(
|| {
Ok(Self {
users: HashMap::new(),
token: None,
default_user: None,
})
},
Ok,
)
}
/// Save the current Minecraft credentials.