This commit is contained in:
2026-04-28 09:27:54 +07:00
commit 68d05da584
320 changed files with 26229 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
import { useRouter } from "next/navigation";
const useGoBack = () => {
const router = useRouter();
const goBack = () => {
if (window.history.length > 1) {
router.back(); // Navigate to the previous route
} else {
router.push("/"); // Redirect to home if no history exists
}
};
return goBack;
};
export default useGoBack;