Add more informative 404 message

This commit is contained in:
2025-12-24 14:13:12 +00:00
parent 52d1984478
commit bd1176fbc3
2 changed files with 4 additions and 5 deletions

View File

@@ -2,7 +2,7 @@
import { deleteLink, getLinkInfo } from "@/app/utils/api";
import { Clipboard } from "lucide-react";
import { useParams } from "next/navigation";
import { redirect, useParams } from "next/navigation";
import { useEffect, useState } from "react";
export default function Home() {
@@ -28,8 +28,7 @@ export default function Home() {
setLoading(true);
try {
await deleteLink(params.id?.toString() || "");
setSuccessMessage("Link deleted!");
setErrorMessage(null);
redirect("/");
} catch (err) {
console.error(err);
setErrorMessage("Failed to delete the link. Please try again.");