nominate animation
This commit is contained in:
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user