mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-28 21:49:40 +02:00
refactor(web): consume runtime config in auth and dashboard flows
This commit is contained in:
parent
9ef2c6a60e
commit
c5dd55e964
9 changed files with 74 additions and 61 deletions
5
surfsense_web/app/desktop/login/layout.tsx
Normal file
5
surfsense_web/app/desktop/login/layout.tsx
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { RuntimeConfig } from "@/components/providers/runtime-config.server";
|
||||
|
||||
export default function DesktopLoginLayout({ children }: { children: React.ReactNode }) {
|
||||
return <RuntimeConfig>{children}</RuntimeConfig>;
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|||
import { toast } from "sonner";
|
||||
import { loginMutationAtom } from "@/atoms/auth/auth-mutation.atoms";
|
||||
import { DEFAULT_SHORTCUTS, keyEventToAccelerator } from "@/components/desktop/shortcut-recorder";
|
||||
import { useIsGoogleAuth } from "@/components/providers/runtime-config";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
|
|
@ -17,9 +18,8 @@ import { Spinner } from "@/components/ui/spinner";
|
|||
import { useElectronAPI } from "@/hooks/use-platform";
|
||||
import { searchSpacesApiService } from "@/lib/apis/search-spaces-api.service";
|
||||
import { setBearerToken } from "@/lib/auth-utils";
|
||||
import { AUTH_TYPE, BACKEND_URL } from "@/lib/env-config";
|
||||
import { BACKEND_URL } from "@/lib/env-config";
|
||||
|
||||
const isGoogleAuth = AUTH_TYPE === "GOOGLE";
|
||||
type ShortcutKey = "generalAssist" | "quickAsk" | "screenshotAssist";
|
||||
type ShortcutMap = typeof DEFAULT_SHORTCUTS;
|
||||
|
||||
|
|
@ -189,6 +189,7 @@ function HotkeyRow({
|
|||
export default function DesktopLoginPage() {
|
||||
const router = useRouter();
|
||||
const api = useElectronAPI();
|
||||
const isGoogleAuth = useIsGoogleAuth();
|
||||
const [{ mutateAsync: login, isPending: isLoggingIn }] = useAtom(loginMutationAtom);
|
||||
|
||||
const [email, setEmail] = useState("");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue