Skip to content

Commit aecfbad

Browse files
committed
pass lint
1 parent e7bb7d6 commit aecfbad

File tree

5 files changed

+27
-30
lines changed

5 files changed

+27
-30
lines changed

apps/oneclient/frontend/src/components/overlay/AddAccountModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function AddAccountModalButton() {
2020
const [authError, setAuthError] = useState<unknown>(null);
2121

2222
const { data: profile, isPending, mutate: login } = useCommandMut(bindings.core.openMsaLogin, {
23-
onSuccess(data) {
23+
onSuccess() {
2424
setAuthError(null);
2525
queryClient.invalidateQueries({
2626
queryKey: ['getUsers'],

apps/oneclient/frontend/src/components/overlay/SuperSecretDevOptions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { minecraftAuthErrors, MinecraftAuthErrorModal, Overlay, RawDebugInfo, SettingsRow, SettingsSwitch, useDebugInfo } from '@/components';
1+
import { MinecraftAuthErrorModal, minecraftAuthErrors, Overlay, RawDebugInfo, SettingsRow, SettingsSwitch, useDebugInfo } from '@/components';
22
import { useSettings } from '@/hooks/useSettings';
33
import { bindings } from '@/main';
44
import { Button } from '@onelauncher/common/components';

apps/oneclient/frontend/src/routes/onboarding/account.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function RouteComponent() {
5858
return bindings.core.getDefaultUser(true);
5959
});
6060
const { data: profile, isPending, mutate: login } = useCommandMut(bindings.core.openMsaLogin, {
61-
onSuccess(data) {
61+
onSuccess() {
6262
setAuthError(null);
6363
queryClient.invalidateQueries({
6464
queryKey: ['getDefaultUser'],

packages/core/src/api/tauri/commands.rs

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -666,32 +666,28 @@ impl TauriLauncherApi for TauriLauncherApiImpl {
666666
return Ok(None);
667667
}
668668

669-
let current_url = match win.url() {
670-
Ok(u) => u,
671-
Err(_) => {
672-
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
673-
continue;
674-
}
669+
let Ok(current_url) = win.url() else {
670+
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
671+
continue;
675672
};
676673

677674
if current_url
678675
.as_str()
679676
.starts_with("https://login.live.com/oauth20_desktop.srf")
677+
&& let Some((_, code)) = current_url.query_pairs().find(|x| x.0 == "code")
680678
{
681-
if let Some((_, code)) = win.url()?.query_pairs().find(|x| x.0 == "code") {
682-
win.close()?;
683-
let value = api::credentials::finish(&code.clone(), flow)
684-
.await
685-
.map_err(|e| {
686-
tracing::error!(
687-
"[auth] open_msa_login() - credentials::finish() failed: {:?}",
688-
e
689-
);
679+
win.close()?;
680+
let value = api::credentials::finish(code.as_ref(), flow)
681+
.await
682+
.map_err(|e| {
683+
tracing::error!(
684+
"[auth] open_msa_login() - credentials::finish() failed: {:?}",
690685
e
691-
})?;
686+
);
687+
e
688+
})?;
692689

693-
return Ok(Some(value));
694-
}
690+
return Ok(Some(value));
695691
}
696692
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
697693
}

packages/core/src/store/credentials.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,16 @@ impl CredentialsStore {
3838
let path = Dirs::get_auth_file().await?;
3939
let store = io::read_json::<Self>(&path).await.ok();
4040

41-
if let Some(s) = store {
42-
Ok(s)
43-
} else {
44-
Ok(Self {
45-
users: HashMap::new(),
46-
token: None,
47-
default_user: None,
48-
})
49-
}
41+
store.map_or_else(
42+
|| {
43+
Ok(Self {
44+
users: HashMap::new(),
45+
token: None,
46+
default_user: None,
47+
})
48+
},
49+
Ok,
50+
)
5051
}
5152

5253
/// Save the current Minecraft credentials.

0 commit comments

Comments
 (0)