From 42c3bb7ec78bbfb420cc1d5a67fc9a8bcf14404a Mon Sep 17 00:00:00 2001 From: Phill Pover Date: Sun, 6 Apr 2025 17:57:18 +0100 Subject: [PATCH] Fixing form submission --- frontend/src/app/album/page.tsx | 15 ++++----------- frontend/src/app/globals.css | 1 + 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/frontend/src/app/album/page.tsx b/frontend/src/app/album/page.tsx index fdd95e0..ffeb2a7 100644 --- a/frontend/src/app/album/page.tsx +++ b/frontend/src/app/album/page.tsx @@ -1,22 +1,18 @@ 'use client'; import { FormEvent, useState, useEffect } from 'react'; -import { usePathname } from "next/navigation"; import Link from 'next/link'; import { Album } from '@/entities/album.entity'; import { createAlbum } from '@/app/actions'; // import CreateAlbumModal from "@/app/components/modals/create-album"; import Button from 'react-bootstrap/Button'; import Modal from 'react-bootstrap/Modal'; -import { useRouter } from 'next/navigation'; export default function Page() { const [albums, setAlbums] = useState([]); const [show, setShow] = useState(false); const handleClose = () => setShow(false); const handleShow = () => setShow(true); - const pathname = usePathname(); - const router = useRouter(); useEffect(() => { async function fetchAlbums() { @@ -27,14 +23,14 @@ export default function Page() { fetchAlbums(); }, []); - async function onSubmit(event: FormEvent) { + const handleSubmit = async (event: FormEvent) => { event.preventDefault(); const formData = new FormData(event.currentTarget); const response = await createAlbum(formData); await response.json(); - router.refresh(); + handleClose(); } if (!albums) return
Loading...
@@ -89,7 +85,7 @@ export default function Page() {
-
+
@@ -108,17 +104,14 @@ export default function Page() {
+
- - -
- diff --git a/frontend/src/app/globals.css b/frontend/src/app/globals.css index 0266619..e689237 100644 --- a/frontend/src/app/globals.css +++ b/frontend/src/app/globals.css @@ -1079,4 +1079,5 @@ there. .has-docked-nav .navbar > .container { width: 80%; + max-height: 55px; }