diff --git a/app/layout.tsx b/app/layout.tsx
index 95986bff..d3810822 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -2,27 +2,29 @@
import "./globals.css";
import Header from "./Header";
import Providers from "./providers";
+import {Metadata} from "next";
-export const metadata = {
+export const metadata: Metadata = {
title: "BayesBond",
description: "A bonding platform for rational thinkers",
};
-export default function RootLayout({
- children,
-}: {
- children: React.ReactNode;
-}) {
+export default function RootLayout(
+ {
+ children,
+ }: {
+ children: React.ReactNode;
+ }) {
return (
-
-
-
-
- {children}
-
-
-
+
+
+
+
+ {children}
+
+
+
);
}
diff --git a/app/profiles/[id]/page.tsx b/app/profiles/[id]/page.tsx
index 6c58beef..ce50c1c5 100644
--- a/app/profiles/[id]/page.tsx
+++ b/app/profiles/[id]/page.tsx
@@ -28,16 +28,21 @@ export default function Post() {
}
const data = await response.json();
setProfile(data);
- console.log(`Data image: ${data.image}`)
+ const img = data.image;
+ console.log(`Data image: ${img}`)
// If user has an image key, fetch the image
- if (data.image) {
- const imageResponse = await fetch(`/api/download?key=${data.image}`);
- console.log(`imageResponse: ${imageResponse}`)
- if (imageResponse.ok) {
- const imageBlob = await imageResponse.json();
- const imageUrl = imageBlob['url'];
- setImage(imageUrl);
+ if (img) {
+ if (img.startsWith('http')) {
+ setImage(img);
+ } else {
+ const imageResponse = await fetch(`/api/download?key=${img}`);
+ console.log(`imageResponse: ${imageResponse}`)
+ if (imageResponse.ok) {
+ const imageBlob = await imageResponse.json();
+ const imageUrl = imageBlob['url'];
+ setImage(imageUrl);
+ }
}
}
} catch (error) {
diff --git a/app/register/page.tsx b/app/register/page.tsx
index 0637ed4f..2916de73 100644
--- a/app/register/page.tsx
+++ b/app/register/page.tsx
@@ -38,6 +38,11 @@ function RegisterComponent() {
};
async function handleSubmit(event: React.FormEvent
) {
+ function handleError(error: unknown) {
+ console.error("Registration error:", error);
+ setError(error instanceof Error ? error.message : "Registration failed");
+ }
+
try {
event.preventDefault();
setIsLoading(true);
@@ -50,7 +55,7 @@ function RegisterComponent() {
// Basic validation
if (!email || !password || !name) {
- throw new Error("All fields are required");
+ handleError("All fields are required");
}
const res = await fetch("/api/auth/signup", {
@@ -61,7 +66,7 @@ function RegisterComponent() {
const data = await res.json();
if (!res.ok) {
- throw new Error(data.error || "Registration failed");
+ handleError(data.error || "Registration failed");
}
// Show a success message with email verification notice
@@ -76,15 +81,14 @@ function RegisterComponent() {
});
if (response?.error) {
- console.error("Sign-in error:", response.error);
- throw new Error("Failed to sign in after registration");
+ handleError("Failed to sign in after registration");
}
redirect()
} catch (error) {
- console.error("Registration error:", error);
- setError(error instanceof Error ? error.message : "Registration failed");
+ handleError(error);
+ } finally {
setIsLoading(false);
}
}
@@ -140,8 +144,9 @@ function RegisterComponent() {
- The project is still in development, you can still sign up if you want to test it, but your account
- may be deleted at any time. To get release updates, fill in this form.
+ The project is still in development. You can sign up if you want to test it, but your account
+ may be deleted at any time. To get release updates, fill in this form.
Create your account
diff --git a/next.config.ts b/next.config.ts
index f92ea0d4..da3856ec 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -8,6 +8,11 @@ const nextConfig: NextConfig = {
hostname: 'bayesbond.s3.eu-north-1.amazonaws.com',
pathname: '/**', // allow all paths
},
+ {
+ protocol: 'https',
+ hostname: 'lh3.googleusercontent.com',
+ pathname: '/**', // allow all paths
+ },
],
},
};