Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions ui/pages/auth/browser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const { userTheme } = useThemeAdapter();
const url = ref<string | null>((route.query.auth_url as string) || null);
const unlistenAuth = ref<UnlistenFn | null>(null);
const unlistenLoginSuccessRef = ref<UnlistenFn | null>(null);
const didCancel = ref(false);

const cardBgClass = computed(() =>
userTheme.value === "dark"
Expand All @@ -28,11 +29,16 @@ const cardBgClass = computed(() =>
const headingClass = computed(() => (userTheme.value === "dark" ? "text-gray-50" : "text-gray-900"));
const subTextClass = computed(() => (userTheme.value === "dark" ? "text-gray-300" : "text-gray-600"));

const back = () => {
const cancelAuthFlow = () => {
if (didCancel.value) return;
didCancel.value = true;
void useTauriCoreInvoke("auth_cancel", {}).catch((error) => {
console.debug("auth_cancel failed:", error);
});
};

const back = () => {
cancelAuthFlow();
navigateTo({
path: localePath({ path: "/" })
});
Expand Down Expand Up @@ -127,9 +133,6 @@ onMounted(async () => {
onBeforeUnmount(() => {
if (unlistenAuth.value) unlistenAuth.value();
if (unlistenLoginSuccessRef.value) unlistenLoginSuccessRef.value();
void useTauriCoreInvoke("auth_cancel", {}).catch((error) => {
console.debug("auth_cancel failed:", error);
});
});
</script>

Expand Down