mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-07-15 08:57:24 +02:00
fix: open cloud login in external browser
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { invoke } from "@tauri-apps/api/core";
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
|
import { openUrl } from "@tauri-apps/plugin-opener";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { LuExternalLink } from "react-icons/lu";
|
import { LuExternalLink } from "react-icons/lu";
|
||||||
@@ -45,7 +46,7 @@ export function DeviceCodeVerifyDialog({
|
|||||||
const handleOpenLogin = async () => {
|
const handleOpenLogin = async () => {
|
||||||
setIsOpeningLogin(true);
|
setIsOpeningLogin(true);
|
||||||
try {
|
try {
|
||||||
await invoke("handle_url_open", { url: DEVICE_LINK_URL });
|
await openUrl(DEVICE_LINK_URL);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to open login link:", error);
|
console.error("Failed to open login link:", error);
|
||||||
showErrorToast(String(error));
|
showErrorToast(String(error));
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { invoke } from "@tauri-apps/api/core";
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
|
import { openUrl } from "@tauri-apps/plugin-opener";
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { LuEye, LuEyeOff } from "react-icons/lu";
|
import { LuEye, LuEyeOff } from "react-icons/lu";
|
||||||
@@ -206,7 +207,7 @@ export function SyncConfigDialog({
|
|||||||
|
|
||||||
const handleOpenLogin = useCallback(async () => {
|
const handleOpenLogin = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
await invoke("handle_url_open", { url: DEVICE_LINK_URL });
|
await openUrl(DEVICE_LINK_URL);
|
||||||
// Hand off the verify step to its own dialog so the user has a
|
// Hand off the verify step to its own dialog so the user has a
|
||||||
// focused place to paste the code, and so it doesn't visually
|
// focused place to paste the code, and so it doesn't visually
|
||||||
// stack with this dialog or any other modal currently on screen.
|
// stack with this dialog or any other modal currently on screen.
|
||||||
|
|||||||
Reference in New Issue
Block a user