diff --git a/app/(default)/Credits/page.jsx b/app/(default)/Credits/page.jsx index 023dffa..7a06a73 100644 --- a/app/(default)/Credits/page.jsx +++ b/app/(default)/Credits/page.jsx @@ -7,6 +7,7 @@ import { auth } from "@/Firebase"; import { PinContainer } from "./creditcards/credits"; import { useRouter } from "next/navigation"; import { FaPencilAlt, FaTrash } from "react-icons/fa"; +import { PuffLoader } from "react-spinners"; export default function PinPage() { const [contributors, setContributors] = useState([]); @@ -128,7 +129,11 @@ export default function PinPage() { Website Contributors - {isLoading &&

Loading...

} + {isLoading && ( +
+ +
+ )} {error &&

{error}

} {!isLoading && !error && contributors.length === 0 && ( @@ -185,81 +190,83 @@ export default function PinPage() { {!isLoading && !error && [...contributors] - .sort((a,b) => a.name.localeCompare(b.name)) - .map((contributor) => ( -
- {/* PinContainer */} - -
- {/* Image wrapper */} -
- {contributor.name} - {/* Overlay description */} -
-

- {contributor.name} -

+ .sort((a, b) => a.name.localeCompare(b.name)) + .map((contributor) => ( +
+ {/* PinContainer */} + +
+ {/* Image wrapper */} +
+ {contributor.name} + {/* Overlay description */} +
+

+ {contributor.name} +

+
-
- + - {/* Edit and Delete Buttons */} -
- - + + +
-
- ))} + ))}
{isAdmin && ( -
- +
+ - -
+ +
)}
); diff --git a/components/ContributorsBtn.tsx b/components/ContributorsBtn.tsx index f2600d5..3749235 100644 --- a/components/ContributorsBtn.tsx +++ b/components/ContributorsBtn.tsx @@ -6,22 +6,25 @@ export const ContributorsBtn = () => { const router = useRouter(); const handleClick = async () => { - try { - const response = await fetch('/api/credits/newCollaborator', { - method: 'POST', + + fetch('/api/credits/newCollaborator', { + method: 'POST', + }) + .then(async (response) => { + if (!response.ok) { + throw new Error('Failed to fetch data from GitHub API'); + } + }) + .catch((err: any) => { + console.error('Error posting contributor:', err.message); }); - if (!response.ok) { - throw new Error('Failed to fetch data from GitHub API'); - } - router.push('/Credits'); - } catch (err:any) { - console.error('Error posting contributor:', err.message); - } + + router.push('/Credits'); }; return (
-