nominate animation

This commit is contained in:
2025-08-03 13:56:41 +02:00
parent 80eb434cde
commit 5ee177e4cf
3 changed files with 41 additions and 29 deletions
+16 -14
View File
@@ -2,30 +2,32 @@
import { useState } from "react";
import { Nunito } from "next/font/google";
import { api } from "muzak/data/fetcher";
import { useAnimation } from "../layout";
const nunito = Nunito({
weight: "900",
subsets: ["latin"],
});
async function nominate(spotifyLink: string) {
console.log(spotifyLink);
try {
const response = await api.tracks.nominate({
spotify_link: spotifyLink,
});
console.log("Nomination successful:", response);
return { success: true, data: response.data };
} catch (error) {
console.error("Nomination failed:", error);
return { success: false, error };
}
}
export default function Nominations() {
const { isAnimate, setIsAnimate } = useAnimation();
const [songURL, setSongURL] = useState("");
const [isLoading, setIsLoading] = useState(false);
const [message, setMessage] = useState("");
async function nominate(spotifyLink: string) {
try {
setIsAnimate(false);
const response = await api.tracks.nominate({
spotify_link: spotifyLink,
});
console.log("Nomination successful:", response);
setIsAnimate(true);
return { success: true, data: response.data };
} catch (error) {
console.error("Nomination failed:", error);
return { success: false, error };
}
}
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">