diff --git a/src/components/auth/LoginForm.tsx b/src/components/auth/LoginForm.tsx index 43ee12e..1f598e4 100644 --- a/src/components/auth/LoginForm.tsx +++ b/src/components/auth/LoginForm.tsx @@ -33,7 +33,6 @@ export function LoginForm( const [loading, setLoading] = useState(false); const [errorMessage, setErrorMessage] = useState(null); - const handleChange = (e: React.ChangeEvent) => { setFormData({ ...formData, [e.target.id]: e.target.value }) } @@ -50,7 +49,6 @@ export function LoginForm( }) } - return ( <> @@ -96,7 +94,6 @@ export function LoginForm( Login with OAuth - diff --git a/src/components/layouts/RootLayout.tsx b/src/components/layouts/RootLayout.tsx index b03ed48..91ff2b5 100644 --- a/src/components/layouts/RootLayout.tsx +++ b/src/components/layouts/RootLayout.tsx @@ -9,12 +9,14 @@ import Loader from "../ui/loader"; import { ArrowRight, TriangleAlert } from "lucide-react"; import Link from "next/link"; import { LoginForm } from "../auth/LoginForm"; +import { useConfig } from "@/contexts/ConfigContext"; type RootLayoutProps = { children: ReactNode; }; export default function RootLayout({ children }: RootLayoutProps) { + const { immichURL, exImmichUrl } = useConfig(); const [user, setUser] = useState(null); const [loading, setLoading] = useState(true); const [errorMessage, setErrorMessage] = useState<{ @@ -40,6 +42,7 @@ export default function RootLayout({ children }: RootLayoutProps) { fetchData(); }, []); + if (loading) return ; if (errorMessage) return ( @@ -49,16 +52,32 @@ export default function RootLayout({ children }: RootLayoutProps) { title={errorMessage.error} description={errorMessage.message} action={ - - Setup Instructions - - +
+ + Setup Instructions + + +
+
+

Connected to (External)

+ + {exImmichUrl || "Not Set"} + +
+
+

Connected to (Internal)

+ + {immichURL} + +
+
+
} /> diff --git a/src/components/shared/ErrorBlock.tsx b/src/components/shared/ErrorBlock.tsx index cf6605c..6cdf5a9 100644 --- a/src/components/shared/ErrorBlock.tsx +++ b/src/components/shared/ErrorBlock.tsx @@ -1,3 +1,5 @@ +import { useConfig } from '@/contexts/ConfigContext'; +import { Link } from 'lucide-react'; import React from 'react' interface ErrorBlockProps { diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index f90289b..d3eaa84 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -6,6 +6,7 @@ import { ENV } from "@/config/environment"; import ConfigContext from "@/contexts/ConfigContext"; import { useEffect, useRef, useState } from "react"; import { getMe } from "@/handlers/api/user.handler"; +import { db } from "@/config/db"; interface AppPropsWithProps extends AppProps { props: { diff --git a/src/pages/api/immich-proxy/thumbnail/[id].ts b/src/pages/api/immich-proxy/thumbnail/[id].ts index 5fb0edb..f554a1e 100644 --- a/src/pages/api/immich-proxy/thumbnail/[id].ts +++ b/src/pages/api/immich-proxy/thumbnail/[id].ts @@ -24,8 +24,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) return res.status(403).json({ message: 'Forbidden' }) } - console.log('currentUser.accessToken:', currentUser) - try { // Forward the request to the target API const response = await fetch(targetUrl, { diff --git a/src/pages/api/users/me.ts b/src/pages/api/users/me.ts index 10f8169..3399615 100644 --- a/src/pages/api/users/me.ts +++ b/src/pages/api/users/me.ts @@ -1,5 +1,6 @@ // pages/api/proxy.js +import { ENV } from "@/config/environment"; import { getCurrentUser } from "@/handlers/serverUtils/user.utils"; import { NextApiRequest, NextApiResponse } from "next"; @@ -13,14 +14,18 @@ export default async function handler( req: NextApiRequest, res: NextApiResponse ) { - if (req.method !== "GET") - - return res.status(405).json({ message: "Method Not Allowed" }); + if (req.method !== "GET") { + return res.status(405).json({ message: "Method Not Allowed" }); + } - const user = await getCurrentUser(req); - console.log("currentUser.accessToken:", user); + try { + const user = await getCurrentUser(req); - if (user) return res.status(200).json(user); + if (user) return res.status(200).json(user); - return res.status(403).json({ message: "Forbidden" }); + return res.status(403).json({ message: "Forbidden" }); + + } catch (error) { + return res.status(500).json(error); + } }