diff --git a/astro.config.mjs b/astro.config.mjs index ffde277..41abc79 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -3,6 +3,7 @@ import { defineConfig } from "astro/config"; import react from "@astrojs/react"; import node from "@astrojs/node"; +// https://astro.build/config export default defineConfig({ integrations: [react()], output: "server", diff --git a/biome.json b/biome.json index f8702e4..3867749 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/1.5.3/schema.json", + "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json", "organizeImports": { "enabled": true }, diff --git a/bun.lockb b/bun.lockb index 5491c44..0661eb3 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 77a3951..afc3877 100644 --- a/package.json +++ b/package.json @@ -4,24 +4,24 @@ "version": "0.0.1", "scripts": { "dev": "bunx --bun astro dev", - "start": "bunx --bun astro dev", "build": "rm -rf dist && bunx --bun astro check && bunx --bun astro build", "preview": "bunx --bun astro preview", "astro": "astro" }, "dependencies": { "@astrojs/check": "^0.7.0", - "@astrojs/node": "^8.2.5", - "@astrojs/react": "^3.4.0", - "@types/react": "^18.3.2", + "@astrojs/node": "^8.3.2", + "@astrojs/react": "^3.6.0", + "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", - "astro": "^4.9.1", + "astro": "^4.11.3", "bootstrap": "^5.3.3", "react": "^18.3.1", "react-dom": "^18.3.1", - "typescript": "^5.3.3" + "react-icons": "^5.2.1", + "typescript": "^5.5.2" }, "devDependencies": { - "@biomejs/biome": "1.7.3" + "@biomejs/biome": "1.8.3" } } diff --git a/src/components/Header.astro b/src/components/Header.astro new file mode 100644 index 0000000..91bf02b --- /dev/null +++ b/src/components/Header.astro @@ -0,0 +1,3 @@ +
+ + diff --git a/src/components/forms/LoginFormData.tsx b/src/components/forms/LoginFormData.tsx index c72bcd5..13a6224 100644 --- a/src/components/forms/LoginFormData.tsx +++ b/src/components/forms/LoginFormData.tsx @@ -2,7 +2,9 @@ import LoginForm, { type LoginFormValue } from "./LoginForm"; export default function LoginFormData() { function handleOnFormSubmit(data: LoginFormValue) { - fetch(`${import.meta.env.PUBLIC_API_URL}/accounts/login`, { + const searchParams = new URLSearchParams(window.location.search); + + fetch("/api/accounts/login", { method: "POST", body: JSON.stringify(data), credentials: "include", @@ -13,7 +15,7 @@ export default function LoginFormData() { }) .then((res) => res.json()) .then((json) => { - window.location.href = "/home"; + window.location.href = searchParams.get("redirect") || "/home"; }) .catch((err) => console.log(err)); } diff --git a/src/layouts/HomeLayout.astro b/src/layouts/HomeLayout.astro index 0bf5bfb..54f5ebc 100644 --- a/src/layouts/HomeLayout.astro +++ b/src/layouts/HomeLayout.astro @@ -1,4 +1,5 @@ --- +import Header from "../components/Header.astro"; import RootLayout from "./RootLayout.astro"; interface Props { @@ -8,13 +9,11 @@ interface Props { const { title } = Astro.props; --- -