refactor: only call oauth in settings window (#972)

This commit is contained in:
ayangweb
2025-11-13 19:50:59 +08:00
committed by GitHub
parent c088dde749
commit c593b07187

View File

@@ -10,7 +10,7 @@ import { useAppStore } from "@/stores/appStore";
import { useConnectStore } from "@/stores/connectStore";
import platformAdapter from "@/utils/platformAdapter";
import { useTranslation } from "react-i18next";
import { MAIN_WINDOW_LABEL } from "@/constants";
import { MAIN_WINDOW_LABEL, SETTINGS_WINDOW_LABEL } from "@/constants";
import { useAsyncEffect, useEventListener } from "ahooks";
export interface DeepLinkHandler {
@@ -86,7 +86,13 @@ export function useDeepLinkManager() {
const handlers: DeepLinkHandler[] = [
{
pattern: "oauth_callback",
handler: handleOAuthCallback,
handler: async (url) => {
const windowLabel = await platformAdapter.getCurrentWindowLabel();
if (windowLabel !== SETTINGS_WINDOW_LABEL) return;
handleOAuthCallback(url);
},
},
{
pattern: "install_extension_from_store",