From 266892dc8df118444013bb8fb976483d00aa80c9 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Fri, 7 Feb 2025 13:31:27 -0800 Subject: [PATCH] Error for http remotes --- src-tauri/yaak-git/src/callbacks.rs | 6 +++--- src-web/components/GitDropdown.tsx | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src-tauri/yaak-git/src/callbacks.rs b/src-tauri/yaak-git/src/callbacks.rs index 38e5a153..e44244d2 100644 --- a/src-tauri/yaak-git/src/callbacks.rs +++ b/src-tauri/yaak-git/src/callbacks.rs @@ -35,7 +35,7 @@ pub(crate) fn default_callbacks<'s>() -> RemoteCallbacks<'s> { } (true, None) => Err(git2::Error::from_str("Couldn't get username from url")), _ => { - todo!("Implement basic auth credential"); + return Err(git2::Error::from_str("https remotes are not (yet) supported")); } } }); @@ -71,6 +71,6 @@ pub(crate) fn default_callbacks<'s>() -> RemoteCallbacks<'s> { debug!("sideband transfer: '{}'", String::from_utf8_lossy(data).trim()); true }); - + callbacks -} \ No newline at end of file +} diff --git a/src-web/components/GitDropdown.tsx b/src-web/components/GitDropdown.tsx index f5b04f2a..059ed2da 100644 --- a/src-web/components/GitDropdown.tsx +++ b/src-web/components/GitDropdown.tsx @@ -214,12 +214,18 @@ function SyncDropdownWithSyncDir({ syncDir }: { syncDir: string }) { leftSlot: , waitForOnSelect: true, async onSelect() { - const message = await push.mutateAsync(); - if (message === 'nothing_to_push') { - showToast({ id: 'push-success', message: 'Nothing to push', color: 'info' }); - } else { - showToast({ id: 'push-success', message: 'Push successful', color: 'success' }); - } + push.mutate(undefined, { + onSuccess(message) { + if (message === 'nothing_to_push') { + showToast({ id: 'push-success', message: 'Nothing to push', color: 'info' }); + } else { + showToast({ id: 'push-success', message: 'Push successful', color: 'success' }); + } + }, + onError(err) { + showErrorToast('git-pull-error', String(err)); + }, + }); }, }, {