diff --git a/next.config.js b/next.config.js index 767719f..658404a 100644 --- a/next.config.js +++ b/next.config.js @@ -1,4 +1,4 @@ /** @type {import('next').NextConfig} */ -const nextConfig = {} +const nextConfig = {}; -module.exports = nextConfig +module.exports = nextConfig; diff --git a/postcss.config.js b/postcss.config.js index 33ad091..12a703d 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -3,4 +3,4 @@ module.exports = { tailwindcss: {}, autoprefixer: {}, }, -} +}; diff --git a/src/app/add/route.ts b/src/app/add/route.ts index 3e85bc0..43a5416 100644 --- a/src/app/add/route.ts +++ b/src/app/add/route.ts @@ -17,7 +17,7 @@ export async function POST(request: Request) { const uri = JSON.stringify(trackRes.body.tracks?.items[0].uri); if (process.env.DENY_EXPLICIT === "true") { if (trackRes.body.tracks?.items[0].explicit) { - return; + return Response.json({ status: "explicit" }); } } diff --git a/src/app/page.tsx b/src/app/page.tsx index cb3a2e2..e4208c7 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -5,7 +5,7 @@ import { useState } from "react"; export default function Home() { const [name, setName] = useState(""); const [artist, setArtist] = useState(""); - const [success, setSuccess] = useState(); + const [status, setStatus] = useState(); return (
@@ -55,29 +55,27 @@ export default function Home() { const json = await res.json(); - if (json.status == "ok") { - setName(""); - setArtist(""); - setSuccess(true); - } else { - setSuccess(false); - } + setStatus(json.status); } catch { - setSuccess(false); + setStatus("error"); } }} > Add - {success === true ? ( + {status === "ok" ? (

Added song!

- ) : success === false ? ( + ) : status === "error" ? (

Error adding song, try again

+ ) : status === "explicit" ? ( +

+ Song is explicit, try again +

) : null}