18 lines
356 B
TypeScript
18 lines
356 B
TypeScript
import { redirect } from "next/navigation";
|
|
import { createNote } from "@/lib/notes";
|
|
|
|
export default async function NewNote() {
|
|
const noteId = await createNote();
|
|
|
|
if (noteId) {
|
|
redirect(`/notes/${noteId}`);
|
|
}
|
|
|
|
return (
|
|
<div className="text-center mt-4">
|
|
Failed to create a new note!<br />
|
|
Please, try again.
|
|
</div>
|
|
);
|
|
}
|